mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-01 02:56:52 +00:00
Check strings in jupyter notebooks
This commit is contained in:
parent
6b03546fc3
commit
cf898e2ce2
7 changed files with 528 additions and 42 deletions
16
tests/string_fixer_for_jupyter_notebooks_test.py
Normal file
16
tests/string_fixer_for_jupyter_notebooks_test.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue