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