Show More
@@ -1,43 +1,46 b'' | |||||
1 | import os |
|
1 | import os | |
2 | import io |
|
2 | import io | |
3 | import nose.tools as nt |
|
3 | import nose.tools as nt | |
4 | from nbconvert import * |
|
4 | from nbconvert import * | |
5 | from nose.tools import nottest |
|
5 | from nose.tools import nottest | |
6 |
|
6 | |||
7 |
|
7 | |||
8 | def test_evens(): |
|
8 | def test_evens(): | |
9 | ###### |
|
9 | ###### | |
10 | # for now, we don't need to really run inkscape to extract svg |
|
10 | # for now, we don't need to really run inkscape to extract svg | |
11 | # from file, on unix, for test, we monkeypathc it to 'true' |
|
11 | # from file, on unix, for test, we monkeypathc it to 'true' | |
12 | # which does not fail as doing anything. |
|
12 | # which does not fail as doing anything. | |
13 | #### |
|
13 | #### | |
14 | ConverterLaTeX.inkscape = 'true' |
|
14 | ConverterLaTeX.inkscape = 'true' | |
15 |
|
15 | |||
16 | converters = [(ConverterRST,'rst'), |
|
16 | # commenting rst for now as travis build | |
|
17 | # fail because of pandoc version. | |||
|
18 | converters = [ | |||
|
19 | #(ConverterRST,'rst'), | |||
17 | (ConverterMarkdown,'md'), |
|
20 | (ConverterMarkdown,'md'), | |
18 | (ConverterLaTeX,'tex'), |
|
21 | (ConverterLaTeX,'tex'), | |
19 | (ConverterPy,'py'), |
|
22 | (ConverterPy,'py'), | |
20 | (ConverterHTML,'html') |
|
23 | (ConverterHTML,'html') | |
21 | ] |
|
24 | ] | |
22 | reflist = [ |
|
25 | reflist = [ | |
23 | 'tests/ipynbref/IntroNumPy.orig' |
|
26 | 'tests/ipynbref/IntroNumPy.orig' | |
24 | ] |
|
27 | ] | |
25 | for root in reflist : |
|
28 | for root in reflist : | |
26 | for conv,ext in converters: |
|
29 | for conv,ext in converters: | |
27 | yield test_conversion, conv,root+'.ipynb',root+'.'+ext |
|
30 | yield test_conversion, conv,root+'.ipynb',root+'.'+ext | |
28 |
|
31 | |||
29 | @nottest |
|
32 | @nottest | |
30 | def compfiles(stra, strb): |
|
33 | def compfiles(stra, strb): | |
31 | nt.assert_equal(map(unicode.strip,stra.split('\n')),map(unicode.strip,strb.split('\n'))) |
|
34 | nt.assert_equal(map(unicode.strip,stra.split('\n')),map(unicode.strip,strb.split('\n'))) | |
32 |
|
35 | |||
33 | @nottest |
|
36 | @nottest | |
34 | def test_conversion(ConverterClass, ipynb, ref_file): |
|
37 | def test_conversion(ConverterClass, ipynb, ref_file): | |
35 |
|
38 | |||
36 | converter = ConverterClass(ipynb) |
|
39 | converter = ConverterClass(ipynb) | |
37 | converter.read() |
|
40 | converter.read() | |
38 | cv =converter.convert() |
|
41 | cv =converter.convert() | |
39 | with io.open(ref_file) as ref: |
|
42 | with io.open(ref_file) as ref: | |
40 | value = ref.read() |
|
43 | value = ref.read() | |
41 | compfiles(cv,value) |
|
44 | compfiles(cv,value) | |
42 |
|
45 | |||
43 |
|
46 |
General Comments 0
You need to be logged in to leave comments.
Login now