From f0f57bc63b6119bbdcae57d3deffbc873409af99 2013-09-14 00:12:16 From: MinRK Date: 2013-09-14 00:12:16 Subject: [PATCH] test that we don't leave any extra CRs in nbconvert --- diff --git a/IPython/nbconvert/tests/test_nbconvertapp.py b/IPython/nbconvert/tests/test_nbconvertapp.py index 4b21bd3..4df503e 100644 --- a/IPython/nbconvert/tests/test_nbconvertapp.py +++ b/IPython/nbconvert/tests/test_nbconvertapp.py @@ -103,6 +103,20 @@ class TestNbConvertApp(TestsBase): assert os.path.isfile('notebook1.tex') assert os.path.isfile('notebook1.pdf') + @dec.onlyif_cmds_exist('pandoc') + def test_spurious_cr(self): + """Check for extra CR characters""" + with self.create_temp_cwd(['notebook2.ipynb']): + self.call('nbconvert --log-level 0 --to latex notebook2') + assert os.path.isfile('notebook2.tex') + with open('notebook2.tex') as f: + tex = f.read() + self.call('nbconvert --log-level 0 --to html notebook2') + assert os.path.isfile('notebook2.html') + with open('notebook2.html') as f: + html = f.read() + self.assertEqual(tex.count('\r'), tex.count('\r\n')) + self.assertEqual(html.count('\r'), html.count('\r\n')) @dec.onlyif_cmds_exist('pandoc') def test_png_base64_html_ok(self): @@ -114,7 +128,6 @@ class TestNbConvertApp(TestsBase): with open('notebook2.html') as f: assert "data:image/png;base64,b'" not in f.read() - @dec.onlyif_cmds_exist('pandoc') def test_template(self): """