test_references.py
47 lines
| 1.3 KiB
| text/x-python
|
PythonLexer
/ tests / test_references.py
Matthias BUSSONNIER
|
r8649 | import io | ||
import nose.tools as nt | ||||
David Warde-Farley
|
r8749 | from nose.tools import nottest | ||
David Warde-Farley
|
r8760 | from converters import ( | ||
David Warde-Farley
|
r8718 | ConverterLaTeX, ConverterMarkdown, ConverterPy, ConverterHTML | ||
) | ||||
Matthias BUSSONNIER
|
r8649 | |||
def test_evens(): | ||||
David Warde-Farley
|
r8718 | ###### | ||
# for now, we don't need to really run inkscape to extract svg | ||||
Matthias BUSSONNIER
|
r8649 | # from file, on unix, for test, we monkeypathc it to 'true' | ||
# which does not fail as doing anything. | ||||
#### | ||||
ConverterLaTeX.inkscape = 'true' | ||||
David Warde-Farley
|
r8718 | # commenting rst for now as travis build | ||
Matthias BUSSONNIER
|
r8687 | # fail because of pandoc version. | ||
converters = [ | ||||
David Warde-Farley
|
r8749 | #(ConverterRST, 'rst'), | ||
David Warde-Farley
|
r8718 | (ConverterMarkdown, 'md'), | ||
(ConverterLaTeX, 'tex'), | ||||
(ConverterPy, 'py'), | ||||
(ConverterHTML, 'html') | ||||
Matthias BUSSONNIER
|
r8649 | ] | ||
reflist = [ | ||||
'tests/ipynbref/IntroNumPy.orig' | ||||
] | ||||
David Warde-Farley
|
r8718 | for root in reflist: | ||
for conv, ext in converters: | ||||
yield test_conversion, conv, root + '.ipynb', root + '.' + ext | ||||
Matthias BUSSONNIER
|
r8649 | |||
@nottest | ||||
Matthias BUSSONNIER
|
r8657 | def compfiles(stra, strb): | ||
David Warde-Farley
|
r8718 | nt.assert_equal(map(unicode.strip, stra.split('\n')), | ||
map(unicode.strip, strb.split('\n'))) | ||||
Matthias BUSSONNIER
|
r8657 | |||
@nottest | ||||
Matthias BUSSONNIER
|
r8649 | def test_conversion(ConverterClass, ipynb, ref_file): | ||
converter = ConverterClass(ipynb) | ||||
converter.read() | ||||
David Warde-Farley
|
r8718 | cv = converter.convert() | ||
Matthias BUSSONNIER
|
r8649 | with io.open(ref_file) as ref: | ||
value = ref.read() | ||||
David Warde-Farley
|
r8718 | compfiles(cv, value) | ||