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