MCPcopy Index your code
hub / github.com/ipython/ipython / test_bad_custom_tb

Method test_bad_custom_tb

tests/test_interactiveshell.py:216–222  ·  view source on GitHub ↗

Check that InteractiveShell is protected from bad custom exception handlers

(self)

Source from the content-addressed store, hash-verified

214 self.assertEqual(ip.user_ns["b"], 22)
215
216 def test_bad_custom_tb(self):
217 """Check that InteractiveShell is protected from bad custom exception handlers"""
218 ip.set_custom_exc((IOError,), lambda etype, value, tb: 1 / 0)
219 self.assertEqual(ip.custom_exceptions, (IOError,))
220 with tt.AssertPrints("Custom TB Handler failed", channel="stderr"):
221 ip.run_cell('raise IOError("foo")')
222 self.assertEqual(ip.custom_exceptions, ())
223
224 def test_bad_custom_tb_return(self):
225 """Check that InteractiveShell is protected from bad return types in custom exception handlers"""

Callers

nothing calls this directly

Calls 2

set_custom_excMethod · 0.80
run_cellMethod · 0.45

Tested by

no test coverage detected