Show More
@@ -53,7 +53,7 b' class TestExporter(ExportersTestsBase):' | |||||
53 | exporter = self._make_exporter(config=config) |
|
53 | exporter = self._make_exporter(config=config) | |
54 | (output, resources) = exporter.from_filename(self._get_notebook()) |
|
54 | (output, resources) = exporter.from_filename(self._get_notebook()) | |
55 | assert resources is not None |
|
55 | assert resources is not None | |
56 |
assert 'outputs' |
|
56 | assert isinstance(resources['outputs'], dict) | |
57 | assert len(resources['outputs']) > 0 |
|
57 | assert len(resources['outputs']) > 0 | |
58 |
|
58 | |||
59 |
|
59 | |||
@@ -65,7 +65,6 b' class TestExporter(ExportersTestsBase):' | |||||
65 | exporter = self._make_exporter(config=config) |
|
65 | exporter = self._make_exporter(config=config) | |
66 | (output, resources) = exporter.from_filename(self._get_notebook()) |
|
66 | (output, resources) = exporter.from_filename(self._get_notebook()) | |
67 | assert resources is not None |
|
67 | assert resources is not None | |
68 | assert 'cheese' in resources |
|
|||
69 | assert resources['cheese'] == 'real' |
|
68 | assert resources['cheese'] == 'real' | |
70 |
|
69 | |||
71 |
|
70 | |||
@@ -77,7 +76,6 b' class TestExporter(ExportersTestsBase):' | |||||
77 | exporter = self._make_exporter(config=config) |
|
76 | exporter = self._make_exporter(config=config) | |
78 | (output, resources) = exporter.from_filename(self._get_notebook()) |
|
77 | (output, resources) = exporter.from_filename(self._get_notebook()) | |
79 | assert resources is not None |
|
78 | assert resources is not None | |
80 | assert 'cheese' in resources |
|
|||
81 | assert resources['cheese'] == 'real' |
|
79 | assert resources['cheese'] == 'real' | |
82 |
|
80 | |||
83 |
|
81 | |||
@@ -89,7 +87,6 b' class TestExporter(ExportersTestsBase):' | |||||
89 | exporter = self._make_exporter(config=config) |
|
87 | exporter = self._make_exporter(config=config) | |
90 | (output, resources) = exporter.from_filename(self._get_notebook()) |
|
88 | (output, resources) = exporter.from_filename(self._get_notebook()) | |
91 | assert resources is not None |
|
89 | assert resources is not None | |
92 | assert 'cheese' in resources |
|
|||
93 | assert resources['cheese'] == 'real' |
|
90 | assert resources['cheese'] == 'real' | |
94 |
|
91 | |||
95 |
|
92 | |||
@@ -101,7 +98,6 b' class TestExporter(ExportersTestsBase):' | |||||
101 | exporter.register_transformer(CheeseTransformer, enabled=True) |
|
98 | exporter.register_transformer(CheeseTransformer, enabled=True) | |
102 | (output, resources) = exporter.from_filename(self._get_notebook()) |
|
99 | (output, resources) = exporter.from_filename(self._get_notebook()) | |
103 | assert resources is not None |
|
100 | assert resources is not None | |
104 | assert 'cheese' in resources |
|
|||
105 | assert resources['cheese'] == 'real' |
|
101 | assert resources['cheese'] == 'real' | |
106 |
|
102 | |||
107 |
|
103 |
@@ -57,7 +57,7 b' class ExtractOutputTransformer(Transformer):' | |||||
57 | output_files_dir = resources.get('output_files_dir', None) |
|
57 | output_files_dir = resources.get('output_files_dir', None) | |
58 |
|
58 | |||
59 | #Make sure outputs key exists |
|
59 | #Make sure outputs key exists | |
60 |
if not 'outputs' |
|
60 | if not isinstance(resources['outputs'], dict): | |
61 | resources['outputs'] = {} |
|
61 | resources['outputs'] = {} | |
62 |
|
62 | |||
63 | #Loop through all of the outputs in the cell |
|
63 | #Loop through all of the outputs in the cell |
@@ -54,7 +54,7 b' class RevealHelpTransformer(Transformer):' | |||||
54 | worksheet.cells[index - 1].metadata.slide_helper = 'subslide_end' |
|
54 | worksheet.cells[index - 1].metadata.slide_helper = 'subslide_end' | |
55 |
|
55 | |||
56 |
|
56 | |||
57 |
if 'reveal' |
|
57 | if not isinstance(resources['reveal'], dict): | |
58 | resources['reveal'] = {} |
|
58 | resources['reveal'] = {} | |
59 | resources['reveal']['url_prefix'] = self.url_prefix |
|
59 | resources['reveal']['url_prefix'] = self.url_prefix | |
60 |
|
60 |
@@ -127,7 +127,7 b' class SphinxTransformer(Transformer):' | |||||
127 | # TODO: Add versatile method of additional notebook metadata. Include |
|
127 | # TODO: Add versatile method of additional notebook metadata. Include | |
128 | # handling of multiple files. For now use a temporay namespace, |
|
128 | # handling of multiple files. For now use a temporay namespace, | |
129 | # '_draft' to signify that this needs to change. |
|
129 | # '_draft' to signify that this needs to change. | |
130 |
if not "sphinx" |
|
130 | if not isinstance(resources["sphinx"], dict): | |
131 | resources["sphinx"] = {} |
|
131 | resources["sphinx"] = {} | |
132 |
|
132 | |||
133 | if self.interactive: |
|
133 | if self.interactive: |
@@ -44,5 +44,4 b' class TestCSSHTMLHeader(TransformerTestsBase):' | |||||
44 | res = self.build_resources() |
|
44 | res = self.build_resources() | |
45 | transformer = self.build_transformer() |
|
45 | transformer = self.build_transformer() | |
46 | nb, res = transformer(nb, res) |
|
46 | nb, res = transformer(nb, res) | |
47 | assert 'inlining' in res |
|
|||
48 | assert 'css' in res['inlining'] No newline at end of file |
|
47 | assert 'css' in res['inlining'] |
@@ -53,9 +53,6 b' class TestExtractOutput(TransformerTestsBase):' | |||||
53 | assert 'png_filename' in nb.worksheets[0].cells[0].outputs[6] |
|
53 | assert 'png_filename' in nb.worksheets[0].cells[0].outputs[6] | |
54 | png_filename = nb.worksheets[0].cells[0].outputs[6]['png_filename'] |
|
54 | png_filename = nb.worksheets[0].cells[0].outputs[6]['png_filename'] | |
55 |
|
55 | |||
56 | # Make sure an entry to the resources was added. |
|
|||
57 | assert 'outputs' in res |
|
|||
58 |
|
||||
59 | # Verify text output |
|
56 | # Verify text output | |
60 | assert text_filename in res['outputs'] |
|
57 | assert text_filename in res['outputs'] | |
61 | self.assertEqual(res['outputs'][text_filename], b'b') |
|
58 | self.assertEqual(res['outputs'][text_filename], b'b') |
@@ -45,7 +45,6 b' class TestSphinx(TransformerTestsBase):' | |||||
45 | res = self.build_resources() |
|
45 | res = self.build_resources() | |
46 | transformer = self.build_transformer() |
|
46 | transformer = self.build_transformer() | |
47 | nb, res = transformer(nb, res) |
|
47 | nb, res = transformer(nb, res) | |
48 | assert 'sphinx' in res |
|
|||
49 | assert "author" in res['sphinx'] |
|
48 | assert "author" in res['sphinx'] | |
50 | assert "version" in res['sphinx'] |
|
49 | assert "version" in res['sphinx'] | |
51 | assert "release" in res['sphinx'] |
|
50 | assert "release" in res['sphinx'] |
@@ -33,7 +33,7 b' class DebugWriter(WriterBase):' | |||||
33 | See base for more... |
|
33 | See base for more... | |
34 | """ |
|
34 | """ | |
35 |
|
35 | |||
36 | if 'outputs' in resources: |
|
36 | if isinstance(resources['outputs'], dict): | |
37 | print("outputs extracted from %s" % notebook_name) |
|
37 | print("outputs extracted from %s" % notebook_name) | |
38 | print('-' * 80) |
|
38 | print('-' * 80) | |
39 | pprint(resources['outputs'], indent=2, width=70) |
|
39 | pprint(resources['outputs'], indent=2, width=70) |
General Comments 0
You need to be logged in to leave comments.
Login now