MCPcopy Create free account
hub / github.com/ipython/ipython / test_run_nb_error

Method test_run_nb_error

IPython/core/tests/test_run.py:405–422  ·  view source on GitHub ↗

Test %run notebook.ipynb error

(self)

Source from the content-addressed store, hash-verified

403 nt.assert_equal(_ip.user_ns['answer'], 42)
404
405 def test_run_nb_error(self):
406 """Test %run notebook.ipynb error"""
407 from nbformat import v4, writes
408 # %run when a file name isn't provided
409 nt.assert_raises(Exception, _ip.magic, "run")
410
411 # %run when a file doesn't exist
412 nt.assert_raises(Exception, _ip.magic, "run foobar.ipynb")
413
414 # %run on a notebook with an error
415 nb = v4.new_notebook(
416 cells=[
417 v4.new_code_cell("0/0")
418 ]
419 )
420 src = writes(nb, version=4)
421 self.mktmp(src, ext='.ipynb')
422 nt.assert_raises(Exception, _ip.magic, "run %s" % self.fname)
423
424 def test_file_options(self):
425 src = ('import sys\n'

Callers

nothing calls this directly

Calls 1

mktmpMethod · 0.80

Tested by

no test coverage detected