##// END OF EJS Templates
inject config as `c` to config file directly...
inject config as `c` to config file directly get_config is not necessary, and removed from default config files. It remains, and will probably remain indefinitely for backward compatibility, so no deprecation warning.

File last commit:

r20757:f9a5cdcb
r20869:cde5f293
Show More
test_html.py
85 lines | 2.6 KiB | text/x-python | PythonLexer
MinRK
test raw cell inclusion based on raw_format metadata
r13665 """Tests for HTMLExporter"""
Jonathan Frederic
Added exporter tests
r11480
Min RK
remove obsolete `onlyif_any_cmd_exists` on nbconvert tests...
r20734 # Copyright (c) IPython Development Team.
Jonathan Frederic
Added exporter tests
r11480 # Distributed under the terms of the Modified BSD License.
from .base import ExportersTestsBase
Jonathan Frederic
Fixed tests
r11740 from ..html import HTMLExporter
Min RK
test that javascript output is included in html export
r20757 from IPython.nbformat import v4
Jessica B. Hamrick
Add regression tests for html nbconvert
r18342 import re
Jonathan Frederic
Added exporter tests
r11480
Jonathan Frederic
Fixed tests
r11740 class TestHTMLExporter(ExportersTestsBase):
MinRK
test raw cell inclusion based on raw_format metadata
r13665 """Tests for HTMLExporter"""
exporter_class = HTMLExporter
should_include_raw = ['html']
Jonathan Frederic
Added exporter tests
r11480
def test_constructor(self):
"""
Jonathan Frederic
Fixed tests
r11740 Can a HTMLExporter be constructed?
Jonathan Frederic
Added exporter tests
r11480 """
Jonathan Frederic
Fixed tests
r11740 HTMLExporter()
Jonathan Frederic
Added exporter tests
r11480
Jonathan Frederic
Add @ivanov 's logic to PANDOC tests
r11749
Jonathan Frederic
Added exporter tests
r11480 def test_export(self):
"""
Jonathan Frederic
Fixed tests
r11740 Can a HTMLExporter export something?
Jonathan Frederic
Added exporter tests
r11480 """
Jonathan Frederic
Fixed tests
r11740 (output, resources) = HTMLExporter().from_filename(self._get_notebook())
Paul Ivanov
skip tests that require pandoc
r11714 assert len(output) > 0
Jonathan Frederic
Updated tests to try flavors
r11738
def test_export_basic(self):
"""
Jonathan Frederic
flavor=template
r11745 Can a HTMLExporter export using the 'basic' template?
Jonathan Frederic
Updated tests to try flavors
r11738 """
MinRK
don't allow 'template' to specify 'template_file'...
r11852 (output, resources) = HTMLExporter(template_file='basic').from_filename(self._get_notebook())
Jonathan Frederic
Updated tests to try flavors
r11738 assert len(output) > 0
def test_export_full(self):
"""
Jonathan Frederic
flavor=template
r11745 Can a HTMLExporter export using the 'full' template?
Jonathan Frederic
Updated tests to try flavors
r11738 """
MinRK
don't allow 'template' to specify 'template_file'...
r11852 (output, resources) = HTMLExporter(template_file='full').from_filename(self._get_notebook())
Jonathan Frederic
Updated tests to try flavors
r11738 assert len(output) > 0
MinRK
test raw cell inclusion based on raw_format metadata
r13665
Jessica B. Hamrick
Add regression tests for html nbconvert
r18342 def test_prompt_number(self):
"""
Does HTMLExporter properly format input and output prompts?
"""
Jessica B. Hamrick
Have prompt number tests use a special prompt number notebook
r18347 (output, resources) = HTMLExporter(template_file='full').from_filename(
self._get_notebook(nb_name="prompt_numbers.ipynb"))
Jessica B. Hamrick
Add regression tests for html nbconvert
r18342 in_regex = r"In \[(.*)\]:"
out_regex = r"Out\[(.*)\]:"
Jessica B. Hamrick
Make prompt numbers notebook more specific
r18349 ins = ["2", "10", " ", " ", "*", "0"]
outs = ["10"]
Jessica B. Hamrick
Add regression tests for html nbconvert
r18342
assert re.findall(in_regex, output) == ins
assert re.findall(out_regex, output) == outs
Johannes Feist
added test for nbconvert html export for pngs with width/height metadata
r19919
def test_png_metadata(self):
"""
Does HTMLExporter with the 'basic' template treat pngs with width/height metadata correctly?
"""
(output, resources) = HTMLExporter(template_file='basic').from_filename(
self._get_notebook(nb_name="pngmetadata.ipynb"))
assert len(output) > 0
Min RK
test that javascript output is included in html export
r20757
def test_javascript_output(self):
nb = v4.new_notebook(
cells=[
v4.new_code_cell(
outputs=[v4.new_output(
output_type='display_data',
data={
'application/javascript': "javascript_output();"
}
)]
)
]
)
(output, resources) = HTMLExporter(template_file='basic').from_notebook_node(nb)
self.assertIn('javascript_output', output)