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