##// END OF EJS Templates
Adds configuration options to use Google Drive content manager...
Adds configuration options to use Google Drive content manager Adds the key contentmanager_js_source to webapp_settings that allows for specifying the content manager JavaScript source file. Also adds a NotebookManager subclass, ClientSideNotebookManager, which does minimal logic. This class is used when the JavaScript content manager doesn't use the Python notebook manager, but rather implements that logic client side, as is the case for the Google Drive based content manager. A sample command line that uses the Google Drive content manager, and the ClientSideNotebookManager, is ipython notebook --NotebookApp.webapp_settings="{'contentmanager_js_source': 'base/js/drive_contentmanager'}" --NotebookApp.notebook_manager_class="IPython.html.services.notebooks.clientsidenbmanager.ClientSideNotebookManager"

File last commit:

r18349:64589602
r18639:28c27a69
Show More
test_html.py
77 lines | 2.5 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
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
from .base import ExportersTestsBase
Jonathan Frederic
Fixed tests
r11740 from ..html import HTMLExporter
MinRK
run html nbconvert tests if node or pandoc is available
r15439 from IPython.testing.decorators import onlyif_any_cmd_exists
Jessica B. Hamrick
Add regression tests for html nbconvert
r18342 import re
Jonathan Frederic
Added exporter tests
r11480
#-----------------------------------------------------------------------------
# Class
#-----------------------------------------------------------------------------
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
MinRK
run html nbconvert tests if node or pandoc is available
r15439 @onlyif_any_cmd_exists('nodejs', 'node', 'pandoc')
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
MinRK
run html nbconvert tests if node or pandoc is available
r15439 @onlyif_any_cmd_exists('nodejs', 'node', 'pandoc')
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
MinRK
run html nbconvert tests if node or pandoc is available
r15439 @onlyif_any_cmd_exists('nodejs', 'node', 'pandoc')
Jonathan Frederic
Updated tests to try flavors
r11738 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 @onlyif_any_cmd_exists('nodejs', 'node', 'pandoc')
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