Show More
@@ -0,0 +1,45 b'' | |||
|
1 | """Tests for ScriptExporter""" | |
|
2 | ||
|
3 | # Copyright (c) IPython Development Team. | |
|
4 | # Distributed under the terms of the Modified BSD License. | |
|
5 | ||
|
6 | import sys | |
|
7 | ||
|
8 | from IPython.nbformat import v4 | |
|
9 | from IPython.utils.py3compat import PY3 | |
|
10 | ||
|
11 | from .base import ExportersTestsBase | |
|
12 | from ..script import ScriptExporter | |
|
13 | ||
|
14 | ||
|
15 | class TestScriptExporter(ExportersTestsBase): | |
|
16 | """Tests for ScriptExporter""" | |
|
17 | ||
|
18 | exporter_class = ScriptExporter | |
|
19 | ||
|
20 | def test_constructor(self): | |
|
21 | """Construct ScriptExporter""" | |
|
22 | e = self.exporter_class() | |
|
23 | ||
|
24 | def test_export(self): | |
|
25 | """ScriptExporter can export something""" | |
|
26 | (output, resources) = self.exporter_class().from_filename(self._get_notebook()) | |
|
27 | assert len(output) > 0 | |
|
28 | ||
|
29 | def test_export_python(self): | |
|
30 | """delegate to custom exporter from language_info""" | |
|
31 | exporter = self.exporter_class() | |
|
32 | ||
|
33 | pynb = v4.new_notebook() | |
|
34 | (output, resources) = self.exporter_class().from_notebook_node(pynb) | |
|
35 | self.assertNotIn('# coding: utf-8', output) | |
|
36 | ||
|
37 | pynb.metadata.language_info = { | |
|
38 | 'name': 'python', | |
|
39 | 'mimetype': 'text/x-python', | |
|
40 | 'nbconvert_exporter': 'python', | |
|
41 | } | |
|
42 | (output, resources) = self.exporter_class().from_notebook_node(pynb) | |
|
43 | self.assertIn('# coding: utf-8', output) | |
|
44 | ||
|
45 | No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now