Show More
@@ -28,8 +28,9 b' class TestCoalesceStreams(TransformerTestsBase):' | |||||
28 | def test_coalesce_streams(self): |
|
28 | def test_coalesce_streams(self): | |
29 | """coalesce_streams transformer output test""" |
|
29 | """coalesce_streams transformer output test""" | |
30 | nb, res = coalesce_streams(self.build_notebook(), self.build_resources()) |
|
30 | nb, res = coalesce_streams(self.build_notebook(), self.build_resources()) | |
31 |
|
|
31 | outputs = nb.worksheets[0].cells[0].outputs | |
32 |
self.assertEqual( |
|
32 | self.assertEqual(outputs[0].text, "a") | |
33 |
self.assertEqual( |
|
33 | self.assertEqual(outputs[1].output_type, "text") | |
34 |
self.assertEqual( |
|
34 | self.assertEqual(outputs[2].text, "cd") | |
|
35 | self.assertEqual(outputs[3].text, "ef") | |||
35 | No newline at end of file |
|
36 |
@@ -25,15 +25,21 b' from ..csshtmlheader import CSSHTMLHeaderTransformer' | |||||
25 | class TestCSSHTMLHeader(TransformerTestsBase): |
|
25 | class TestCSSHTMLHeader(TransformerTestsBase): | |
26 | """Contains test functions for csshtmlheader.py""" |
|
26 | """Contains test functions for csshtmlheader.py""" | |
27 |
|
27 | |||
28 | def test_constructor(self): |
|
28 | ||
29 | """Can a CSSHTMLHeaderTransformer be constructed?""" |
|
29 | def build_transformer(self): | |
|
30 | """Make an instance of a transformer""" | |||
30 | transformer = CSSHTMLHeaderTransformer() |
|
31 | transformer = CSSHTMLHeaderTransformer() | |
31 | transformer.enabled = True |
|
32 | transformer.enabled = True | |
32 | return transformer |
|
33 | return transformer | |
33 |
|
34 | |||
34 |
|
35 | |||
|
36 | def test_constructor(self): | |||
|
37 | """Can a CSSHTMLHeaderTransformer be constructed?""" | |||
|
38 | self.build_transformer() | |||
|
39 | ||||
|
40 | ||||
35 | def test_output(self): |
|
41 | def test_output(self): | |
36 | """Test the output of the CSSHTMLHeaderTransformer""" |
|
42 | """Test the output of the CSSHTMLHeaderTransformer""" | |
37 |
nb, res = self. |
|
43 | nb, res = self.build_transformer()(self.build_notebook(), self.build_resources()) | |
38 | assert 'inlining' in res |
|
44 | assert 'inlining' in res | |
39 | assert 'css' in res['inlining'] No newline at end of file |
|
45 | assert 'css' in res['inlining'] |
@@ -25,16 +25,22 b' from ..extractoutput import ExtractOutputTransformer' | |||||
25 | class TestExtractOutput(TransformerTestsBase): |
|
25 | class TestExtractOutput(TransformerTestsBase): | |
26 | """Contains test functions for extractoutput.py""" |
|
26 | """Contains test functions for extractoutput.py""" | |
27 |
|
27 | |||
28 | def test_constructor(self): |
|
28 | ||
29 | """Can a ExtractOutputTransformer be constructed?""" |
|
29 | def build_transformer(self): | |
|
30 | """Make an instance of a transformer""" | |||
30 | transformer = ExtractOutputTransformer() |
|
31 | transformer = ExtractOutputTransformer() | |
31 | transformer.enabled = True |
|
32 | transformer.enabled = True | |
32 | return transformer |
|
33 | return transformer | |
33 |
|
34 | |||
34 |
|
35 | |||
|
36 | def test_constructor(self): | |||
|
37 | """Can a ExtractOutputTransformer be constructed?""" | |||
|
38 | self.build_transformer() | |||
|
39 | ||||
|
40 | ||||
35 | def test_output(self): |
|
41 | def test_output(self): | |
36 | """Test the output of the ExtractOutputTransformer""" |
|
42 | """Test the output of the ExtractOutputTransformer""" | |
37 |
nb, res = self. |
|
43 | nb, res = self.build_transformer()(self.build_notebook(), self.build_resources()) | |
38 |
|
44 | |||
39 | # Check if text was extracted. |
|
45 | # Check if text was extracted. | |
40 | assert 'text_filename' in nb.worksheets[0].cells[0].outputs[1] |
|
46 | assert 'text_filename' in nb.worksheets[0].cells[0].outputs[1] |
@@ -25,16 +25,21 b' from ..latex import LatexTransformer' | |||||
25 | class TestLatex(TransformerTestsBase): |
|
25 | class TestLatex(TransformerTestsBase): | |
26 | """Contains test functions for latex.py""" |
|
26 | """Contains test functions for latex.py""" | |
27 |
|
27 | |||
28 | def test_constructor(self): |
|
28 | ||
29 | """Can a LatexTransformer be constructed?""" |
|
29 | def build_transformer(self): | |
|
30 | """Make an instance of a transformer""" | |||
30 | transformer = LatexTransformer() |
|
31 | transformer = LatexTransformer() | |
31 | transformer.enabled = True |
|
32 | transformer.enabled = True | |
32 | return transformer |
|
33 | return transformer | |
33 |
|
34 | |||
|
35 | def test_constructor(self): | |||
|
36 | """Can a LatexTransformer be constructed?""" | |||
|
37 | self.build_transformer() | |||
|
38 | ||||
34 |
|
39 | |||
35 | def test_output(self): |
|
40 | def test_output(self): | |
36 | """Test the output of the LatexTransformer""" |
|
41 | """Test the output of the LatexTransformer""" | |
37 |
nb, res = self. |
|
42 | nb, res = self.build_transformer()(self.build_notebook(), self.build_resources()) | |
38 |
|
43 | |||
39 | # Make sure the code cell wasn't modified. |
|
44 | # Make sure the code cell wasn't modified. | |
40 | self.assertEqual(nb.worksheets[0].cells[0].input, '$ e $') |
|
45 | self.assertEqual(nb.worksheets[0].cells[0].input, '$ e $') |
@@ -45,40 +45,35 b' class Testrevealhelp(TransformerTestsBase):' | |||||
45 |
|
45 | |||
46 | return nbformat.new_notebook(name="notebook1", worksheets=worksheets) |
|
46 | return nbformat.new_notebook(name="notebook1", worksheets=worksheets) | |
47 |
|
47 | |||
48 | def test_constructor(self): |
|
48 | ||
49 | """Can a RevealHelpTransformer be constructed?""" |
|
49 | def build_transformer(self): | |
|
50 | """Make an instance of a transformer""" | |||
50 | transformer = RevealHelpTransformer() |
|
51 | transformer = RevealHelpTransformer() | |
51 | transformer.enabled = True |
|
52 | transformer.enabled = True | |
52 | return transformer |
|
53 | return transformer | |
53 |
|
54 | |||
54 |
|
55 | |||
|
56 | def test_constructor(self): | |||
|
57 | """Can a RevealHelpTransformer be constructed?""" | |||
|
58 | self.build_transformer() | |||
|
59 | ||||
|
60 | ||||
55 | def test_reveal_attribute(self): |
|
61 | def test_reveal_attribute(self): | |
56 | """Make sure the reveal url_prefix resources is set""" |
|
62 | """Make sure the reveal url_prefix resources is set""" | |
57 |
nb, res = self. |
|
63 | nb, res = self.build_transformer()(self.build_notebook(), self.build_resources()) | |
58 | assert 'reveal' in res |
|
64 | assert 'reveal' in res | |
59 | assert 'url_prefix' in res['reveal'] |
|
65 | assert 'url_prefix' in res['reveal'] | |
60 |
|
66 | |||
61 |
|
67 | |||
62 | def test_reveal_output(self): |
|
68 | def test_reveal_output(self): | |
63 | """Make sure that the reveal transformer """ |
|
69 | """Make sure that the reveal transformer """ | |
64 |
nb, res = self. |
|
70 | nb, res = self.build_transformer()(self.build_notebook(), self.build_resources()) | |
65 | cells = nb.worksheets[0].cells |
|
71 | cells = nb.worksheets[0].cells | |
66 |
|
72 | |||
67 | # Make sure correct metadata tags are available on every cell. |
|
73 | # Make sure correct metadata tags are available on every cell. | |
68 | assert 'slide_type' in cells[0].metadata |
|
74 | for cell in cells: | |
69 |
assert ' |
|
75 | assert 'slide_type' in cell.metadata | |
70 |
|
76 | assert 'align_type' in cell.metadata | ||
71 | assert 'slide_type' in cells[1].metadata |
|
|||
72 | assert 'align_type' in cells[1].metadata |
|
|||
73 |
|
||||
74 | assert 'slide_type' in cells[2].metadata |
|
|||
75 | assert 'align_type' in cells[2].metadata |
|
|||
76 |
|
||||
77 | assert 'slide_type' in cells[3].metadata |
|
|||
78 | assert 'align_type' in cells[3].metadata |
|
|||
79 |
|
||||
80 | assert 'slide_type' in cells[4].metadata |
|
|||
81 | assert 'align_type' in cells[4].metadata |
|
|||
82 |
|
77 | |||
83 | # Make sure slide end is only applied to the cells preceeding slide |
|
78 | # Make sure slide end is only applied to the cells preceeding slide | |
84 | # cells. |
|
79 | # cells. |
@@ -25,17 +25,23 b' from ..sphinx import SphinxTransformer' | |||||
25 | class TestSphinx(TransformerTestsBase): |
|
25 | class TestSphinx(TransformerTestsBase): | |
26 | """Contains test functions for sphinx.py""" |
|
26 | """Contains test functions for sphinx.py""" | |
27 |
|
27 | |||
28 | def test_constructor(self): |
|
28 | ||
29 | """Can a SphinxTransformer be constructed?""" |
|
29 | def build_transformer(self): | |
|
30 | """Make an instance of a transformer""" | |||
30 | transformer = SphinxTransformer() |
|
31 | transformer = SphinxTransformer() | |
31 | transformer.enabled = True |
|
32 | transformer.enabled = True | |
32 | return transformer |
|
33 | return transformer | |
33 |
|
34 | |||
34 |
|
35 | |||
|
36 | def test_constructor(self): | |||
|
37 | """Can a SphinxTransformer be constructed?""" | |||
|
38 | self.build_transformer() | |||
|
39 | ||||
|
40 | ||||
35 | def test_resources(self): |
|
41 | def test_resources(self): | |
36 | """Make sure the SphinxTransformer adds the appropriate resources to the |
|
42 | """Make sure the SphinxTransformer adds the appropriate resources to the | |
37 | resources dict.""" |
|
43 | resources dict.""" | |
38 |
nb, res = self. |
|
44 | nb, res = self.build_transformer()(self.build_notebook(), self.build_resources()) | |
39 | assert 'sphinx' in res |
|
45 | assert 'sphinx' in res | |
40 | assert "author" in res['sphinx'] |
|
46 | assert "author" in res['sphinx'] | |
41 | assert "version" in res['sphinx'] |
|
47 | assert "version" in res['sphinx'] |
@@ -68,15 +68,20 b' class Testsvg2pdf(TransformerTestsBase):' | |||||
68 | return nbformat.new_notebook(name="notebook1", worksheets=worksheets) |
|
68 | return nbformat.new_notebook(name="notebook1", worksheets=worksheets) | |
69 |
|
69 | |||
70 |
|
70 | |||
71 |
def |
|
71 | def build_transformer(self): | |
72 | """Can a SVG2PDFTransformer be constructed?""" |
|
72 | """Make an instance of a transformer""" | |
73 | transformer = SVG2PDFTransformer() |
|
73 | transformer = SVG2PDFTransformer() | |
74 | transformer.enabled = True |
|
74 | transformer.enabled = True | |
75 | return transformer |
|
75 | return transformer | |
76 |
|
76 | |||
77 |
|
77 | |||
|
78 | def test_constructor(self): | |||
|
79 | """Can a SVG2PDFTransformer be constructed?""" | |||
|
80 | self.build_transformer() | |||
|
81 | ||||
|
82 | ||||
78 | @dec.onlyif_cmds_exist('inkscape') |
|
83 | @dec.onlyif_cmds_exist('inkscape') | |
79 | def test_output(self): |
|
84 | def test_output(self): | |
80 | """Test the output of the SVG2PDFTransformer""" |
|
85 | """Test the output of the SVG2PDFTransformer""" | |
81 |
nb, res = self. |
|
86 | nb, res = self.build_transformer()(self.build_notebook(), self.build_resources()) | |
82 | assert 'svg' in nb.worksheets[0].cells[0].outputs[0] |
|
87 | assert 'svg' in nb.worksheets[0].cells[0].outputs[0] |
General Comments 0
You need to be logged in to leave comments.
Login now