##// END OF EJS Templates
py3 unicode fix for output_png key
Jonathan Frederic -
Show More
@@ -1,53 +1,53 b''
1 """
1 """
2 Module with utility functions for transformer tests
2 Module with utility functions for transformer tests
3 """
3 """
4
4
5 #-----------------------------------------------------------------------------
5 #-----------------------------------------------------------------------------
6 # Copyright (c) 2013, the IPython Development Team.
6 # Copyright (c) 2013, the IPython Development Team.
7 #
7 #
8 # Distributed under the terms of the Modified BSD License.
8 # Distributed under the terms of the Modified BSD License.
9 #
9 #
10 # The full license is in the file COPYING.txt, distributed with this software.
10 # The full license is in the file COPYING.txt, distributed with this software.
11 #-----------------------------------------------------------------------------
11 #-----------------------------------------------------------------------------
12
12
13 #-----------------------------------------------------------------------------
13 #-----------------------------------------------------------------------------
14 # Imports
14 # Imports
15 #-----------------------------------------------------------------------------
15 #-----------------------------------------------------------------------------
16
16
17 from IPython.nbformat import current as nbformat
17 from IPython.nbformat import current as nbformat
18
18
19 from ...tests.base import TestsBase
19 from ...tests.base import TestsBase
20 from ...exporters.exporter import ResourcesDict
20 from ...exporters.exporter import ResourcesDict
21
21
22 #-----------------------------------------------------------------------------
22 #-----------------------------------------------------------------------------
23 # Class
23 # Class
24 #-----------------------------------------------------------------------------
24 #-----------------------------------------------------------------------------
25
25
26 class TransformerTestsBase(TestsBase):
26 class TransformerTestsBase(TestsBase):
27 """Contains test functions transformer tests"""
27 """Contains test functions transformer tests"""
28
28
29
29
30 def build_notebook(self):
30 def build_notebook(self):
31 """Build a notebook in memory for use with transformer tests"""
31 """Build a notebook in memory for use with transformer tests"""
32
32
33 outputs = [nbformat.new_output(output_type="stream", stream="stdout", output_text="a"),
33 outputs = [nbformat.new_output(output_type="stream", stream="stdout", output_text="a"),
34 nbformat.new_output(output_type="text", output_text="b"),
34 nbformat.new_output(output_type="text", output_text="b"),
35 nbformat.new_output(output_type="stream", stream="stdout", output_text="c"),
35 nbformat.new_output(output_type="stream", stream="stdout", output_text="c"),
36 nbformat.new_output(output_type="stream", stream="stdout", output_text="d"),
36 nbformat.new_output(output_type="stream", stream="stdout", output_text="d"),
37 nbformat.new_output(output_type="stream", stream="stderr", output_text="e"),
37 nbformat.new_output(output_type="stream", stream="stderr", output_text="e"),
38 nbformat.new_output(output_type="stream", stream="stderr", output_text="f"),
38 nbformat.new_output(output_type="stream", stream="stderr", output_text="f"),
39 nbformat.new_output(output_type="png", output_png='Zw==')] #g
39 nbformat.new_output(output_type="png", output_png=u'Zw==')] #g
40
40
41 cells=[nbformat.new_code_cell(input="$ e $", prompt_number=1,outputs=outputs),
41 cells=[nbformat.new_code_cell(input="$ e $", prompt_number=1,outputs=outputs),
42 nbformat.new_text_cell('markdown', source="$ e $")]
42 nbformat.new_text_cell('markdown', source="$ e $")]
43 worksheets = [nbformat.new_worksheet(name="worksheet1", cells=cells)]
43 worksheets = [nbformat.new_worksheet(name="worksheet1", cells=cells)]
44
44
45 return nbformat.new_notebook(name="notebook1", worksheets=worksheets)
45 return nbformat.new_notebook(name="notebook1", worksheets=worksheets)
46
46
47
47
48 def build_resources(self):
48 def build_resources(self):
49 """Build an empty resources dictionary."""
49 """Build an empty resources dictionary."""
50
50
51 res = ResourcesDict()
51 res = ResourcesDict()
52 res['metadata'] = ResourcesDict()
52 res['metadata'] = ResourcesDict()
53 return res No newline at end of file
53 return res
General Comments 0
You need to be logged in to leave comments. Login now