From 72286e950d645d65f21c79726a749b72ce07ba89 2013-08-07 16:13:48
From: Jonathan Frederic <jdfreder@calpoly.edu>
Date: 2013-08-07 16:13:48
Subject: [PATCH] Fixes small things pointed out by @minrk

---

diff --git a/IPython/nbconvert/transformers/tests/test_coalescestreams.py b/IPython/nbconvert/transformers/tests/test_coalescestreams.py
index fe421fa..7dc9be2 100644
--- a/IPython/nbconvert/transformers/tests/test_coalescestreams.py
+++ b/IPython/nbconvert/transformers/tests/test_coalescestreams.py
@@ -28,8 +28,9 @@ class TestCoalesceStreams(TransformerTestsBase):
     def test_coalesce_streams(self):
         """coalesce_streams transformer output test"""
         nb, res = coalesce_streams(self.build_notebook(), self.build_resources())
-        self.assertEqual(nb.worksheets[0].cells[0].outputs[0].text, "a")
-        self.assertEqual(nb.worksheets[0].cells[0].outputs[1].output_type, "text")
-        self.assertEqual(nb.worksheets[0].cells[0].outputs[2].text, "cd")
-        self.assertEqual(nb.worksheets[0].cells[0].outputs[3].text, "ef")
+        outputs = nb.worksheets[0].cells[0].outputs
+        self.assertEqual(outputs[0].text, "a")
+        self.assertEqual(outputs[1].output_type, "text")
+        self.assertEqual(outputs[2].text, "cd")
+        self.assertEqual(outputs[3].text, "ef")
     
\ No newline at end of file
diff --git a/IPython/nbconvert/transformers/tests/test_csshtmlheader.py b/IPython/nbconvert/transformers/tests/test_csshtmlheader.py
index f9f1810..6183e12 100644
--- a/IPython/nbconvert/transformers/tests/test_csshtmlheader.py
+++ b/IPython/nbconvert/transformers/tests/test_csshtmlheader.py
@@ -25,15 +25,21 @@ from ..csshtmlheader import CSSHTMLHeaderTransformer
 class TestCSSHTMLHeader(TransformerTestsBase):
     """Contains test functions for csshtmlheader.py"""
 
-    def test_constructor(self):
-        """Can a CSSHTMLHeaderTransformer be constructed?"""
+
+    def build_transformer(self):
+        """Make an instance of a transformer"""
         transformer = CSSHTMLHeaderTransformer()
         transformer.enabled = True
         return transformer
+
+
+    def test_constructor(self):
+        """Can a CSSHTMLHeaderTransformer be constructed?"""
+        self.build_transformer()
     
 
     def test_output(self):
         """Test the output of the CSSHTMLHeaderTransformer"""
-        nb, res = self.test_constructor()(self.build_notebook(), self.build_resources())
+        nb, res = self.build_transformer()(self.build_notebook(), self.build_resources())
         assert 'inlining' in res
         assert 'css' in res['inlining'] 
\ No newline at end of file
diff --git a/IPython/nbconvert/transformers/tests/test_extractoutput.py b/IPython/nbconvert/transformers/tests/test_extractoutput.py
index 1038f0d..0e47780 100644
--- a/IPython/nbconvert/transformers/tests/test_extractoutput.py
+++ b/IPython/nbconvert/transformers/tests/test_extractoutput.py
@@ -25,16 +25,22 @@ from ..extractoutput import ExtractOutputTransformer
 class TestExtractOutput(TransformerTestsBase):
     """Contains test functions for extractoutput.py"""
 
-    def test_constructor(self):
-        """Can a ExtractOutputTransformer be constructed?"""
+
+    def build_transformer(self):
+        """Make an instance of a transformer"""
         transformer = ExtractOutputTransformer()
         transformer.enabled = True
         return transformer
+
+
+    def test_constructor(self):
+        """Can a ExtractOutputTransformer be constructed?"""
+        self.build_transformer()
     
 
     def test_output(self):
         """Test the output of the ExtractOutputTransformer"""
-        nb, res = self.test_constructor()(self.build_notebook(), self.build_resources())
+        nb, res = self.build_transformer()(self.build_notebook(), self.build_resources())
 
         # Check if text was extracted.
         assert 'text_filename' in nb.worksheets[0].cells[0].outputs[1]
diff --git a/IPython/nbconvert/transformers/tests/test_latex.py b/IPython/nbconvert/transformers/tests/test_latex.py
index f32fb2a..663e8b6 100644
--- a/IPython/nbconvert/transformers/tests/test_latex.py
+++ b/IPython/nbconvert/transformers/tests/test_latex.py
@@ -25,16 +25,21 @@ from ..latex import LatexTransformer
 class TestLatex(TransformerTestsBase):
     """Contains test functions for latex.py"""
 
-    def test_constructor(self):
-        """Can a LatexTransformer be constructed?"""
+
+    def build_transformer(self):
+        """Make an instance of a transformer"""
         transformer = LatexTransformer()
         transformer.enabled = True
         return transformer
-    
+
+    def test_constructor(self):
+        """Can a LatexTransformer be constructed?"""
+        self.build_transformer()
+        
 
     def test_output(self):
         """Test the output of the LatexTransformer"""
-        nb, res = self.test_constructor()(self.build_notebook(), self.build_resources())
+        nb, res = self.build_transformer()(self.build_notebook(), self.build_resources())
 
         # Make sure the code cell wasn't modified.
         self.assertEqual(nb.worksheets[0].cells[0].input, '$ e $')
diff --git a/IPython/nbconvert/transformers/tests/test_revealhelp.py b/IPython/nbconvert/transformers/tests/test_revealhelp.py
index 0f93f7c..87b797a 100644
--- a/IPython/nbconvert/transformers/tests/test_revealhelp.py
+++ b/IPython/nbconvert/transformers/tests/test_revealhelp.py
@@ -45,40 +45,35 @@ class Testrevealhelp(TransformerTestsBase):
 
         return nbformat.new_notebook(name="notebook1", worksheets=worksheets)
 
-    def test_constructor(self):
-        """Can a RevealHelpTransformer be constructed?"""
+
+    def build_transformer(self):
+        """Make an instance of a transformer"""
         transformer = RevealHelpTransformer()
         transformer.enabled = True
         return transformer
+
+
+    def test_constructor(self):
+        """Can a RevealHelpTransformer be constructed?"""
+        self.build_transformer()
     
 
     def test_reveal_attribute(self):
         """Make sure the reveal url_prefix resources is set"""
-        nb, res = self.test_constructor()(self.build_notebook(), self.build_resources())
+        nb, res = self.build_transformer()(self.build_notebook(), self.build_resources())
         assert 'reveal' in res
         assert  'url_prefix' in res['reveal']
 
 
     def test_reveal_output(self):
         """Make sure that the reveal transformer """
-        nb, res = self.test_constructor()(self.build_notebook(), self.build_resources())
+        nb, res = self.build_transformer()(self.build_notebook(), self.build_resources())
         cells = nb.worksheets[0].cells
         
         # Make sure correct metadata tags are available on every cell.
-        assert 'slide_type' in cells[0].metadata
-        assert 'align_type' in cells[0].metadata
-
-        assert 'slide_type' in cells[1].metadata
-        assert 'align_type' in cells[1].metadata
-
-        assert 'slide_type' in cells[2].metadata
-        assert 'align_type' in cells[2].metadata
-
-        assert 'slide_type' in cells[3].metadata
-        assert 'align_type' in cells[3].metadata
-
-        assert 'slide_type' in cells[4].metadata
-        assert 'align_type' in cells[4].metadata
+        for cell in cells:
+            assert 'slide_type' in cell.metadata
+            assert 'align_type' in cell.metadata
 
         # Make sure slide end is only applied to the cells preceeding slide 
         # cells.
diff --git a/IPython/nbconvert/transformers/tests/test_sphinx.py b/IPython/nbconvert/transformers/tests/test_sphinx.py
index 8078247..f66b4a6 100644
--- a/IPython/nbconvert/transformers/tests/test_sphinx.py
+++ b/IPython/nbconvert/transformers/tests/test_sphinx.py
@@ -25,17 +25,23 @@ from ..sphinx import SphinxTransformer
 class TestSphinx(TransformerTestsBase):
     """Contains test functions for sphinx.py"""
 
-    def test_constructor(self):
-        """Can a SphinxTransformer be constructed?"""
+
+    def build_transformer(self):
+        """Make an instance of a transformer"""
         transformer = SphinxTransformer()
         transformer.enabled = True
         return transformer
+
+
+    def test_constructor(self):
+        """Can a SphinxTransformer be constructed?"""
+        self.build_transformer()
     
 
     def test_resources(self):
         """Make sure the SphinxTransformer adds the appropriate resources to the
         resources dict."""
-        nb, res = self.test_constructor()(self.build_notebook(), self.build_resources())
+        nb, res = self.build_transformer()(self.build_notebook(), self.build_resources())
         assert 'sphinx' in res
         assert "author" in res['sphinx']
         assert "version" in res['sphinx']
diff --git a/IPython/nbconvert/transformers/tests/test_svg2pdf.py b/IPython/nbconvert/transformers/tests/test_svg2pdf.py
index a6f8bcf..a008981 100644
--- a/IPython/nbconvert/transformers/tests/test_svg2pdf.py
+++ b/IPython/nbconvert/transformers/tests/test_svg2pdf.py
@@ -68,15 +68,20 @@ class Testsvg2pdf(TransformerTestsBase):
         return nbformat.new_notebook(name="notebook1", worksheets=worksheets)
 
 
-    def test_constructor(self):
-        """Can a SVG2PDFTransformer be constructed?"""
+    def build_transformer(self):
+        """Make an instance of a transformer"""
         transformer = SVG2PDFTransformer()
         transformer.enabled = True
         return transformer
-    
+
+
+    def test_constructor(self):
+        """Can a SVG2PDFTransformer be constructed?"""
+        self.build_transformer()
+        
 
     @dec.onlyif_cmds_exist('inkscape')
     def test_output(self):
         """Test the output of the SVG2PDFTransformer"""
-        nb, res = self.test_constructor()(self.build_notebook(), self.build_resources())
+        nb, res = self.build_transformer()(self.build_notebook(), self.build_resources())
         assert 'svg' in nb.worksheets[0].cells[0].outputs[0]