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