Show More
@@ -1,20 +1,24 b'' | |||
|
1 | 1 | from nbconvert import ConverterNotebook |
|
2 | 2 | import nose.tools as nt |
|
3 | import os | |
|
3 | import os, json | |
|
4 | 4 | |
|
5 | 5 | fname = 'tests/test.ipynb' |
|
6 | 6 | outbase1 = 'newtest1' |
|
7 | outbase2 = 'newtest2' | |
|
7 | outbase2 = 'test' # will output to ./test.ipynb | |
|
8 | 8 | |
|
9 | 9 | def test_roundtrip(): |
|
10 | 10 | converter = ConverterNotebook(fname, outbase1) |
|
11 | 11 | converter.render() |
|
12 | 12 | |
|
13 | 13 | converter2 = ConverterNotebook(outbase1+'.ipynb', outbase2) |
|
14 | 14 | converter2.render() |
|
15 | 15 | |
|
16 | 16 | s1 = open(outbase1+'.ipynb', 'rb').read() |
|
17 | 17 | s2 = open(outbase2+'.ipynb', 'rb').read() |
|
18 | 18 | nt.assert_true(s1.replace(outbase1, outbase2) == s2) |
|
19 | 19 | os.remove(outbase1+'.ipynb') |
|
20 | 20 | os.remove(outbase2+'.ipynb') |
|
21 | ||
|
22 | s0 = json.dumps(json.load(file(fname)), indent=1, sort_keys=True) | |
|
23 | nt.assert_true(s0 == s2) | |
|
24 |
General Comments 0
You need to be logged in to leave comments.
Login now