Show More
@@ -1,48 +1,48 | |||
|
1 | 1 | """ |
|
2 | 2 | Module with tests for the coalescestreams transformer |
|
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 ...tests.base import TestsBase |
|
18 | 18 | from ..coalescestreams import coalesce_streams |
|
19 | 19 | |
|
20 | 20 | from IPython.nbformat import current as nbformat |
|
21 | 21 | |
|
22 | 22 | #----------------------------------------------------------------------------- |
|
23 | 23 | # Class |
|
24 | 24 | #----------------------------------------------------------------------------- |
|
25 | 25 | |
|
26 | 26 | class TestCoalesceStreams(TestsBase): |
|
27 | 27 | """Contains test functions for coalescestreams.py""" |
|
28 | 28 | |
|
29 | 29 | |
|
30 |
def build_ |
|
|
30 | def build_notebook(self): | |
|
31 | 31 | outputs = [nbformat.new_output(output_type="stream", stream="stdout", output_text="a"), |
|
32 | 32 | nbformat.new_output(output_type="text", output_text="b"), |
|
33 | 33 | nbformat.new_output(output_type="stream", stream="stdout", output_text="c"), |
|
34 | 34 | nbformat.new_output(output_type="stream", stream="stdout", output_text="d"), |
|
35 | 35 | nbformat.new_output(output_type="stream", stream="stderr", output_text="e"), |
|
36 | 36 | nbformat.new_output(output_type="stream", stream="stderr", output_text="f")] |
|
37 | 37 | cells=[nbformat.new_code_cell(input="test", |
|
38 | 38 | prompt_number=1,outputs=outputs)] |
|
39 | 39 | worksheets = [nbformat.new_worksheet(name="worksheet1", cells=cells)] |
|
40 | 40 | return nbformat.new_notebook(name="notebook1", worksheets=worksheets) |
|
41 | 41 | |
|
42 | 42 | def test_coalesce_streams(self): |
|
43 |
nb, res = coalesce_streams(self.build_ |
|
|
43 | nb, res = coalesce_streams(self.build_notebook(), {}) | |
|
44 | 44 | self.assertEqual(nb.worksheets[0].cells[0].outputs[0].text, "a") |
|
45 | 45 | self.assertEqual(nb.worksheets[0].cells[0].outputs[1].output_type, "text") |
|
46 | 46 | self.assertEqual(nb.worksheets[0].cells[0].outputs[2].text, "cd") |
|
47 | 47 | self.assertEqual(nb.worksheets[0].cells[0].outputs[3].text, "ef") |
|
48 | 48 | No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now