diff --git a/IPython/nbformat/v3/nbbase.py b/IPython/nbformat/v3/nbbase.py index f4e312b..c8089d7 100644 --- a/IPython/nbformat/v3/nbbase.py +++ b/IPython/nbformat/v3/nbbase.py @@ -53,7 +53,7 @@ def from_dict(d): def new_output(output_type=None, output_text=None, output_png=None, output_html=None, output_svg=None, output_latex=None, output_json=None, output_javascript=None, output_jpeg=None, prompt_number=None, - etype=None, evalue=None, traceback=None): + etype=None, evalue=None, traceback=None, stream=None): """Create a new code cell with input and output""" output = NotebookNode() if output_type is not None: @@ -89,6 +89,9 @@ def new_output(output_type=None, output_text=None, output_png=None, if traceback is not None: output.traceback = [unicode(frame) for frame in list(traceback)] + if output_type == u'stream': + output.stream = 'stdout' if stream is None else unicode(stream) + return output diff --git a/IPython/nbformat/v3/tests/nbexamples.py b/IPython/nbformat/v3/tests/nbexamples.py index efdd38e..fa9b5cf 100644 --- a/IPython/nbformat/v3/tests/nbexamples.py +++ b/IPython/nbformat/v3/tests/nbexamples.py @@ -93,6 +93,7 @@ ws.cells.append(new_code_cell( output_text='foo\rbar\r\n' ),new_output( output_type=u'stream', + stream='stderr', output_text='\rfoo\rbar\n' )] ))