##// END OF EJS Templates
This feature was discussed in #6123, but it doesn't look like anything was ever incorporated into the IPython Notebook....
This feature was discussed in #6123, but it doesn't look like anything was ever incorporated into the IPython Notebook. Here's a brief overview of the changes: - Display of messages from other clients can be toggled on and off from within a notebook, either using the ``<M-m>e`` keyboard shortcut in the web UI, or through the option in the "Kernel" menu. - notebook.js controls whether messages are displayed through a callback that is invoked from kernel.js when no callbacks are available for a message. - The UI displays ``execute_input`` messages originating from an other clients in new cells at the end of the notebook. Output messages (``execute_result`` et al.) will only be displayed if a cell exists with a matching message ID. Pending design questions: - Should each ``execute_input`` message cause a new cell to be created? - Should new cells be placed at the end of the notebook, or elsewhere? If the latter, what criteria should be followed?

File last commit:

r18605:9867311c
r19164:17ac8ca3
Show More
test_export.py
90 lines | 2.4 KiB | text/x-python | PythonLexer
Jonathan Frederic
Added exporter tests
r11480 """
Module with tests for export.py
"""
MinRK
Don't use nbformat.current in nbconvert
r18605 # Copyright (c) IPython Development Team.
Jonathan Frederic
Added exporter tests
r11480 # Distributed under the terms of the Modified BSD License.
import os
MinRK
Don't use nbformat.current in nbconvert
r18605 from IPython import nbformat
Jonathan Frederic
Added exporter tests
r11480
from .base import ExportersTestsBase
from ..export import *
from ..python import PythonExporter
Jonathan Frederic
s/Test_/Test
r11494 class TestExport(ExportersTestsBase):
Jonathan Frederic
Added exporter tests
r11480 """Contains test functions for export.py"""
def test_export_wrong_name(self):
"""
Is the right error thrown when a bad template name is used?
"""
try:
export_by_name('not_a_name', self._get_notebook())
except ExporterNameError as e:
pass
def test_export_filename(self):
"""
Can a notebook be exported by filename?
"""
(output, resources) = export_by_name('python', self._get_notebook())
assert len(output) > 0
def test_export_nbnode(self):
"""
Can a notebook be exported by a notebook node handle?
"""
with open(self._get_notebook(), 'r') as f:
MinRK
Don't use nbformat.current in nbconvert
r18605 notebook = nbformat.read(f, 4)
Jonathan Frederic
Added exporter tests
r11480 (output, resources) = export_by_name('python', notebook)
assert len(output) > 0
def test_export_filestream(self):
"""
Can a notebook be exported by a filesteam?
"""
with open(self._get_notebook(), 'r') as f:
(output, resources) = export_by_name('python', f)
assert len(output) > 0
def test_export_using_exporter(self):
"""
Can a notebook be exported using an instanciated exporter?
"""
(output, resources) = export(PythonExporter(), self._get_notebook())
assert len(output) > 0
def test_export_using_exporter_class(self):
"""
Can a notebook be exported using an exporter class type?
"""
(output, resources) = export(PythonExporter, self._get_notebook())
assert len(output) > 0
def test_export_resources(self):
"""
Can a notebook be exported along with a custom resources dict?
"""
(output, resources) = export(PythonExporter, self._get_notebook(), resources={})
assert len(output) > 0
def test_no_exporter(self):
"""
Is the right error thrown if no exporter is provided?
"""
try:
(output, resources) = export(None, self._get_notebook())
except TypeError:
pass
Matthias BUSSONNIER
Exporter -> TemplateExporter / BaseExporter
r12500