Show More
@@ -1,19 +1,11 b'' | |||||
1 |
""" |
|
1 | """NotebookExporter class""" | |
2 |
|
2 | |||
3 | # Copyright (c) IPython Development Team. |
|
3 | # Copyright (c) IPython Development Team. | |
4 | # Distributed under the terms of the Modified BSD License. |
|
4 | # Distributed under the terms of the Modified BSD License. | |
5 |
|
5 | |||
6 | #----------------------------------------------------------------------------- |
|
|||
7 | # Imports |
|
|||
8 | #----------------------------------------------------------------------------- |
|
|||
9 |
|
||||
10 | from .exporter import Exporter |
|
6 | from .exporter import Exporter | |
11 | from IPython.nbformat import current as nbformat |
|
7 | from IPython.nbformat import current as nbformat | |
12 |
|
8 | |||
13 | #----------------------------------------------------------------------------- |
|
|||
14 | # Classes |
|
|||
15 | #----------------------------------------------------------------------------- |
|
|||
16 |
|
||||
17 | class NotebookExporter(Exporter): |
|
9 | class NotebookExporter(Exporter): | |
18 | """ |
|
10 | """ | |
19 | Exports an IPython notebook. |
|
11 | Exports an IPython notebook. | |
@@ -27,5 +19,3 b' class NotebookExporter(Exporter):' | |||||
27 | nb_copy, resources = super(NotebookExporter, self).from_notebook_node(nb, resources, **kw) |
|
19 | nb_copy, resources = super(NotebookExporter, self).from_notebook_node(nb, resources, **kw) | |
28 | output = nbformat.writes_json(nb_copy) |
|
20 | output = nbformat.writes_json(nb_copy) | |
29 | return output, resources |
|
21 | return output, resources | |
30 |
|
||||
31 |
|
@@ -1,33 +1,16 b'' | |||||
1 | """ |
|
1 | """Tests for notebook.py""" | |
2 | Module with tests for notebook.py |
|
|||
3 | """ |
|
|||
4 |
|
2 | |||
5 | # Copyright (c) IPython Development Team. |
|
3 | # Copyright (c) IPython Development Team. | |
6 | # Distributed under the terms of the Modified BSD License. |
|
4 | # Distributed under the terms of the Modified BSD License. | |
7 |
|
5 | |||
8 | #----------------------------------------------------------------------------- |
|
|||
9 | # Imports |
|
|||
10 | #----------------------------------------------------------------------------- |
|
|||
11 |
|
||||
12 | from .base import ExportersTestsBase |
|
6 | from .base import ExportersTestsBase | |
13 | from ..notebook import NotebookExporter |
|
7 | from ..notebook import NotebookExporter | |
14 |
|
8 | |||
15 | #----------------------------------------------------------------------------- |
|
|||
16 | # Class |
|
|||
17 | #----------------------------------------------------------------------------- |
|
|||
18 |
|
||||
19 | class TestNotebookExporter(ExportersTestsBase): |
|
9 | class TestNotebookExporter(ExportersTestsBase): | |
20 | """Contains test functions for notebook.py""" |
|
10 | """Contains test functions for notebook.py""" | |
21 |
|
11 | |||
22 | exporter_class = NotebookExporter |
|
12 | exporter_class = NotebookExporter | |
23 |
|
13 | |||
24 | def test_constructor(self): |
|
|||
25 | """ |
|
|||
26 | Can a NotebookExporter be constructed? |
|
|||
27 | """ |
|
|||
28 | NotebookExporter() |
|
|||
29 |
|
||||
30 |
|
||||
31 | def test_export(self): |
|
14 | def test_export(self): | |
32 | """ |
|
15 | """ | |
33 | Does the NotebookExporter return the file unchanged? |
|
16 | Does the NotebookExporter return the file unchanged? | |
@@ -37,4 +20,3 b' class TestNotebookExporter(ExportersTestsBase):' | |||||
37 | (output, resources) = NotebookExporter().from_filename(self._get_notebook()) |
|
20 | (output, resources) = NotebookExporter().from_filename(self._get_notebook()) | |
38 | assert len(output) > 0 |
|
21 | assert len(output) > 0 | |
39 | assert output == file_contents |
|
22 | assert output == file_contents | |
40 |
|
General Comments 0
You need to be logged in to leave comments.
Login now