mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-05 11:36:54 +00:00
16 lines
484 B
Python
16 lines
484 B
Python
from pre_commit_hooks.string_fixer_for_jupyter_notebooks import main
|
|
from testing.util import get_resource_path
|
|
|
|
|
|
def test_rewrite(tmpdir):
|
|
with open(get_resource_path('before.ipynb')) as f:
|
|
before_contents = f.read()
|
|
|
|
with open(get_resource_path('after.ipynb')) as f:
|
|
after_contents = f.read()
|
|
|
|
path = tmpdir.join('file.ipynb')
|
|
path.write(before_contents)
|
|
retval = main([str(path)])
|
|
assert path.read() == after_contents
|
|
assert retval == 1
|