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