##// END OF EJS Templates
Added latex transformer test
Jonathan Frederic -
Show More
@@ -0,0 +1,43 b''
1 """
2 Module with tests for the latex transformer
3 """
4
5 #-----------------------------------------------------------------------------
6 # Copyright (c) 2013, the IPython Development Team.
7 #
8 # Distributed under the terms of the Modified BSD License.
9 #
10 # The full license is in the file COPYING.txt, distributed with this software.
11 #-----------------------------------------------------------------------------
12
13 #-----------------------------------------------------------------------------
14 # Imports
15 #-----------------------------------------------------------------------------
16
17 from .base import TransformerTestsBase
18 from ..latex import LatexTransformer
19
20
21 #-----------------------------------------------------------------------------
22 # Class
23 #-----------------------------------------------------------------------------
24
25 class TestLatex(TransformerTestsBase):
26 """Contains test functions for latex.py"""
27
28 def test_constructor(self):
29 """Can a LatexTransformer be constructed?"""
30 transformer = LatexTransformer()
31 transformer.enabled = True
32 return transformer
33
34
35 def test_output(self):
36 """Test the output of the LatexTransformer"""
37 nb, res = self.test_constructor()(self.build_notebook(), {})
38
39 # Make sure the code cell wasn't modified.
40 self.assertEqual(nb.worksheets[0].cells[0].input, '$ e $')
41
42 # Verify that the markdown cell was processed.
43 self.assertEqual(nb.worksheets[0].cells[1].source, '$e$')
@@ -37,8 +37,8 b' class TransformerTestsBase(TestsBase):'
37 nbformat.new_output(output_type="stream", stream="stderr", output_text="f"),
37 nbformat.new_output(output_type="stream", stream="stderr", output_text="f"),
38 nbformat.new_output(output_type="png", output_png='Zw==')] #g
38 nbformat.new_output(output_type="png", output_png='Zw==')] #g
39
39
40 cells=[nbformat.new_code_cell(input="test",
40 cells=[nbformat.new_code_cell(input="$ e $", prompt_number=1,outputs=outputs),
41 prompt_number=1,outputs=outputs)]
41 nbformat.new_text_cell('markdown', source="$ e $")]
42 worksheets = [nbformat.new_worksheet(name="worksheet1", cells=cells)]
42 worksheets = [nbformat.new_worksheet(name="worksheet1", cells=cells)]
43
43
44 return nbformat.new_notebook(name="notebook1", worksheets=worksheets)
44 return nbformat.new_notebook(name="notebook1", worksheets=worksheets)
General Comments 0
You need to be logged in to leave comments. Login now