Show More
@@ -371,6 +371,23 tclass.py: deleting object: C-third | |||
|
371 | 371 | with tt.AssertNotPrints('SystemExit'): |
|
372 | 372 | _ip.magic('run -e %s' % self.fname) |
|
373 | 373 |
|
|
374 | def test_run_nb(self): | |
|
375 | """Test %run notebook.ipynb""" | |
|
376 | from IPython.nbformat import current | |
|
377 | nb = current.new_notebook( | |
|
378 | worksheets=[ | |
|
379 | current.new_worksheet(cells=[ | |
|
380 | current.new_code_cell("answer=42") | |
|
381 | ]) | |
|
382 | ] | |
|
383 | ) | |
|
384 | src = current.writes(nb, 'json') | |
|
385 | self.mktmp(src, ext='.ipynb') | |
|
386 | ||
|
387 | _ip.magic("run %s" % self.fname) | |
|
388 | ||
|
389 | nt.assert_equal(_ip.user_ns['answer'], 42) | |
|
390 | ||
|
374 | 391 | |
|
375 | 392 | |
|
376 | 393 | class TestMagicRunWithPackage(unittest.TestCase): |
General Comments 0
You need to be logged in to leave comments.
Login now