##// END OF EJS Templates
Added test
Jonathan Frederic -
Show More
@@ -14,6 +14,8 b' Module with tests for the coalescestreams preprocessor'
14 # Imports
14 # Imports
15 #-----------------------------------------------------------------------------
15 #-----------------------------------------------------------------------------
16
16
17 from IPython.nbformat import current as nbformat
18
17 from .base import PreprocessorTestsBase
19 from .base import PreprocessorTestsBase
18 from ..coalescestreams import coalesce_streams
20 from ..coalescestreams import coalesce_streams
19
21
@@ -35,4 +37,24 b' class TestCoalesceStreams(PreprocessorTestsBase):'
35 self.assertEqual(outputs[1].output_type, "text")
37 self.assertEqual(outputs[1].output_type, "text")
36 self.assertEqual(outputs[2].text, "cd")
38 self.assertEqual(outputs[2].text, "cd")
37 self.assertEqual(outputs[3].text, "ef")
39 self.assertEqual(outputs[3].text, "ef")
38
40
41
42 def test_coalesce_sequenced_streams(self):
43 """Can the coalesce streams preprocessor merge a sequence of streams?"""
44
45 outputs = [nbformat.new_output(output_type="stream", stream="stdout", output_text="0"),
46 nbformat.new_output(output_type="stream", stream="stdout", output_text="1"),
47 nbformat.new_output(output_type="stream", stream="stdout", output_text="2"),
48 nbformat.new_output(output_type="stream", stream="stdout", output_text="3"),
49 nbformat.new_output(output_type="stream", stream="stdout", output_text="4"),
50 nbformat.new_output(output_type="stream", stream="stdout", output_text="5"),
51 nbformat.new_output(output_type="stream", stream="stdout", output_text="6"),
52 nbformat.new_output(output_type="stream", stream="stdout", output_text="7")]
53 cells=[nbformat.new_code_cell(input="# None", prompt_number=1,outputs=outputs)]
54 worksheets = [nbformat.new_worksheet(name="worksheet1", cells=cells)]
55
56 nb = nbformat.new_notebook(name="notebook1", worksheets=worksheets)
57 res = self.build_resources()
58 nb, res = coalesce_streams(nb, res)
59 outputs = nb.worksheets[0].cells[0].outputs
60 self.assertEqual(outputs[0].text, u'01234567')
General Comments 0
You need to be logged in to leave comments. Login now