From 7502c604b2544b38a9a76dfa9c4e043a281f7f0d 2013-11-18 20:08:25 From: MinRK Date: 2013-11-18 20:08:25 Subject: [PATCH] test %run notebook.ipynb --- diff --git a/IPython/core/tests/test_run.py b/IPython/core/tests/test_run.py index c5c8d4a..a084b16 100644 --- a/IPython/core/tests/test_run.py +++ b/IPython/core/tests/test_run.py @@ -370,6 +370,23 @@ tclass.py: deleting object: C-third with tt.AssertNotPrints('SystemExit'): _ip.magic('run -e %s' % self.fname) + + def test_run_nb(self): + """Test %run notebook.ipynb""" + from IPython.nbformat import current + nb = current.new_notebook( + worksheets=[ + current.new_worksheet(cells=[ + current.new_code_cell("answer=42") + ]) + ] + ) + src = current.writes(nb, 'json') + self.mktmp(src, ext='.ipynb') + + _ip.magic("run %s" % self.fname) + + nt.assert_equal(_ip.user_ns['answer'], 42)