Show More
@@ -44,7 +44,7 b' def new_output(output_type, mime_bundle=None, **kwargs):' | |||||
44 | # populate defaults: |
|
44 | # populate defaults: | |
45 | output.setdefault('metadata', NotebookNode()) |
|
45 | output.setdefault('metadata', NotebookNode()) | |
46 | if output_type == 'stream': |
|
46 | if output_type == 'stream': | |
47 |
output.setdefault(' |
|
47 | output.setdefault('name', 'stdout') | |
48 | output.setdefault('text', '') |
|
48 | output.setdefault('text', '') | |
49 | validate(output, output_type) |
|
49 | validate(output, output_type) | |
50 | return output |
|
50 | return output |
@@ -250,15 +250,15 b'' | |||||
250 | "description": "Stream output from a code cell.", |
|
250 | "description": "Stream output from a code cell.", | |
251 | "type": "object", |
|
251 | "type": "object", | |
252 | "additionalProperties": false, |
|
252 | "additionalProperties": false, | |
253 |
"required": ["output_type", "metadata", " |
|
253 | "required": ["output_type", "metadata", "name", "text"], | |
254 | "properties": { |
|
254 | "properties": { | |
255 | "output_type": { |
|
255 | "output_type": { | |
256 | "description": "Type of cell output.", |
|
256 | "description": "Type of cell output.", | |
257 | "enum": ["stream"] |
|
257 | "enum": ["stream"] | |
258 | }, |
|
258 | }, | |
259 | "metadata": {"$ref": "#/definitions/misc/output_metadata"}, |
|
259 | "metadata": {"$ref": "#/definitions/misc/output_metadata"}, | |
260 |
" |
|
260 | "name": { | |
261 |
"description": "The stream |
|
261 | "description": "The name of the stream (stdout, stderr).", | |
262 | "type": "string" |
|
262 | "type": "string" | |
263 | }, |
|
263 | }, | |
264 | "text": { |
|
264 | "text": { |
@@ -91,7 +91,7 b' cells.append(new_code_cell(' | |||||
91 | text='foo\rbar\r\n' |
|
91 | text='foo\rbar\r\n' | |
92 | ),new_output( |
|
92 | ),new_output( | |
93 | output_type=u'stream', |
|
93 | output_type=u'stream', | |
94 |
|
|
94 | name='stderr', | |
95 | text='\rfoo\rbar\n' |
|
95 | text='\rfoo\rbar\n' | |
96 | )] |
|
96 | )] | |
97 | )) |
|
97 | )) |
@@ -55,8 +55,10 b' def test_empty_display_data():' | |||||
55 | nt.assert_equal(output.output_type, 'display_data') |
|
55 | nt.assert_equal(output.output_type, 'display_data') | |
56 |
|
56 | |||
57 | def test_empty_stream(): |
|
57 | def test_empty_stream(): | |
58 |
output = new_output('stream' |
|
58 | output = new_output('stream') | |
59 | nt.assert_equal(output.output_type, 'stream') |
|
59 | nt.assert_equal(output.output_type, 'stream') | |
|
60 | nt.assert_equal(output.name, 'stdout') | |||
|
61 | nt.assert_equal(output.text, '') | |||
60 |
|
62 | |||
61 | def test_empty_execute_result(): |
|
63 | def test_empty_execute_result(): | |
62 | output = new_output('execute_result', prompt_number=1) |
|
64 | output = new_output('execute_result', prompt_number=1) | |
@@ -103,3 +105,8 b' def test_code_cell_with_outputs():' | |||||
103 | er = cell.outputs[-1] |
|
105 | er = cell.outputs[-1] | |
104 | nt.assert_equal(er.prompt_number, 10) |
|
106 | nt.assert_equal(er.prompt_number, 10) | |
105 | nt.assert_equal(er['output_type'], 'execute_result') |
|
107 | nt.assert_equal(er['output_type'], 'execute_result') | |
|
108 | ||||
|
109 | def test_stream(): | |||
|
110 | output = new_output('stream', name='stderr', text='hello there') | |||
|
111 | nt.assert_equal(output.name, 'stderr') | |||
|
112 | nt.assert_equal(output.text, 'hello there') |
General Comments 0
You need to be logged in to leave comments.
Login now