From 7eeb476dfa7aba806edec432c8a31854f17ecbd0 2013-07-26 22:46:51 From: Jonathan Frederic Date: 2013-07-26 22:46:51 Subject: [PATCH] Fixed tests --- diff --git a/IPython/nbconvert/exporters/tests/test_html.py b/IPython/nbconvert/exporters/tests/test_html.py index e182928..7499eb4 100644 --- a/IPython/nbconvert/exporters/tests/test_html.py +++ b/IPython/nbconvert/exporters/tests/test_html.py @@ -15,50 +15,50 @@ Module with tests for basichtml.py #----------------------------------------------------------------------------- from .base import ExportersTestsBase -from ..basichtml import BasicHTMLExporter +from ..html import HTMLExporter from IPython.testing.decorators import onlyif_cmds_exist #----------------------------------------------------------------------------- # Class #----------------------------------------------------------------------------- -class TestBasicHTMLExporter(ExportersTestsBase): +class TestHTMLExporter(ExportersTestsBase): """Contains test functions for basichtml.py""" def test_constructor(self): """ - Can a BasicHTMLExporter be constructed? + Can a HTMLExporter be constructed? """ - BasicHTMLExporter() + HTMLExporter() @onlyif_cmds_exist('pandoc') def test_export(self): """ - Can a BasicHTMLExporter export something? + Can a HTMLExporter export something? """ - (output, resources) = BasicHTMLExporter().from_filename(self._get_notebook()) + (output, resources) = HTMLExporter().from_filename(self._get_notebook()) assert len(output) > 0 def test_export_basic(self): """ - Can a BasicHTMLExporter export using the 'basic' flavor? + Can a HTMLExporter export using the 'basic' flavor? """ - (output, resources) = BasicHTMLExporter(flavor='basic').from_filename(self._get_notebook()) + (output, resources) = HTMLExporter(flavor='basic').from_filename(self._get_notebook()) assert len(output) > 0 def test_export_full(self): """ - Can a BasicHTMLExporter export using the 'full' flavor? + Can a HTMLExporter export using the 'full' flavor? """ - (output, resources) = BasicHTMLExporter(flavor='full').from_filename(self._get_notebook()) + (output, resources) = HTMLExporter(flavor='full').from_filename(self._get_notebook()) assert len(output) > 0 def test_export_reveal(self): """ - Can a BasicHTMLExporter export using the 'reveal' flavor? + Can a HTMLExporter export using the 'reveal' flavor? """ - (output, resources) = BasicHTMLExporter(flavor='reveal').from_filename(self._get_notebook()) + (output, resources) = HTMLExporter(flavor='reveal').from_filename(self._get_notebook()) assert len(output) > 0 \ No newline at end of file diff --git a/IPython/nbconvert/exporters/tests/test_latex.py b/IPython/nbconvert/exporters/tests/test_latex.py index be50131..9fc885f 100644 --- a/IPython/nbconvert/exporters/tests/test_latex.py +++ b/IPython/nbconvert/exporters/tests/test_latex.py @@ -41,11 +41,11 @@ class TestLatexExporter(ExportersTestsBase): assert len(output) > 0 - def test_export_full(self): + def test_export_book(self): """ - Can a LatexExporter export using 'full' flavor? + Can a LatexExporter export using 'book' flavor? """ - (output, resources) = LatexExporter(flavor='full').from_filename(self._get_notebook()) + (output, resources) = LatexExporter(flavor='book').from_filename(self._get_notebook()) assert len(output) > 0 @@ -57,9 +57,9 @@ class TestLatexExporter(ExportersTestsBase): assert len(output) > 0 - def test_export_reveal(self): + def test_export_article(self): """ - Can a LatexExporter export using 'reveal' flavor? + Can a LatexExporter export using 'article' flavor? """ - (output, resources) = LatexExporter(flavor='reveal').from_filename(self._get_notebook()) + (output, resources) = LatexExporter(flavor='article').from_filename(self._get_notebook()) assert len(output) > 0 \ No newline at end of file diff --git a/IPython/nbconvert/tests/test_nbconvertapp.py b/IPython/nbconvert/tests/test_nbconvertapp.py index 2e83757..5add7a5 100644 --- a/IPython/nbconvert/tests/test_nbconvertapp.py +++ b/IPython/nbconvert/tests/test_nbconvertapp.py @@ -52,7 +52,7 @@ class TestNbConvertApp(TestsBase): """ with self.create_temp_cwd(['notebook*.ipynb']): assert not 'error' in self.call([IPYTHON, 'nbconvert', - '--format="python"', '--notebooks=["*.ipynb"]']).lower() + '--to="python"', '--notebooks=["*.ipynb"]']).lower() assert os.path.isfile('notebook1.py') assert os.path.isfile('notebook2.py') @@ -63,7 +63,7 @@ class TestNbConvertApp(TestsBase): """ with self.create_temp_cwd() as cwd: self.copy_files_to(['notebook*.ipynb'], 'subdir/') - assert not 'error' in self.call([IPYTHON, 'nbconvert', '--format="python"', + assert not 'error' in self.call([IPYTHON, 'nbconvert', '--to="python"', '--notebooks=["%s"]' % os.path.join('subdir', '*.ipynb')]).lower() assert os.path.isfile('notebook1.py') assert os.path.isfile('notebook2.py') @@ -74,18 +74,30 @@ class TestNbConvertApp(TestsBase): Do explicit notebook names work? """ with self.create_temp_cwd(['notebook*.ipynb']): - assert not 'error' in self.call([IPYTHON, 'nbconvert', '--format="python"', + assert not 'error' in self.call([IPYTHON, 'nbconvert', '--to="python"', '--notebooks=["notebook2.ipynb"]']).lower() assert not os.path.isfile('notebook1.py') assert os.path.isfile('notebook2.py') + def test_flavor(self): + """ + Do explicit notebook names work? + """ + with self.create_temp_cwd(['notebook*.ipynb']): + assert not 'error' in self.call([IPYTHON, 'nbconvert', '--to="html"', + '--notebooks=["notebook2.ipynb"]', '--flavor="reveal"']).lower() + assert os.path.isfile('notebook2.html') + with open('notebook2.html') as f: + assert '/reveal.css' in f.read() + + def test_glob_explicit(self): """ Can a search pattern be used along with matching explicit notebook names? """ with self.create_temp_cwd(['notebook*.ipynb']): - assert not 'error' in self.call([IPYTHON, 'nbconvert', '--format="python"', + assert not 'error' in self.call([IPYTHON, 'nbconvert', '--to="python"', '--notebooks=["*.ipynb", "notebook1.ipynb", "notebook2.ipynb"]']).lower() assert os.path.isfile('notebook1.py') assert os.path.isfile('notebook2.py') @@ -96,7 +108,7 @@ class TestNbConvertApp(TestsBase): Can explicit notebook names be used and then a matching search pattern? """ with self.create_temp_cwd(['notebook*.ipynb']): - assert not 'error' in self.call([IPYTHON, 'nbconvert', '--format="python"', + assert not 'error' in self.call([IPYTHON, 'nbconvert', '--to="python"', '--notebooks=["notebook1.ipynb", "notebook2.ipynb", "*.ipynb"]']).lower() assert os.path.isfile('notebook1.py') assert os.path.isfile('notebook2.py')