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

Function test_handlers

IPython/core/tests/test_ultratb.py:400–438  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

398
399# module testing (minimal)
400def test_handlers():
401 def spam(c, d_e):
402 (d, e) = d_e
403 x = c + d
404 y = c * d
405 foo(x, y)
406
407 def foo(a, b, bar=1):
408 eggs(a, b + bar)
409
410 def eggs(f, g, z=globals()):
411 h = f + g
412 i = f - g
413 return h / i
414
415 buff = io.StringIO()
416
417 buff.write('')
418 buff.write('*** Before ***')
419 try:
420 buff.write(spam(1, (2, 3)))
421 except:
422 traceback.print_exc(file=buff)
423
424 handler = ColorTB(ostream=buff)
425 buff.write('*** ColorTB ***')
426 try:
427 buff.write(spam(1, (2, 3)))
428 except:
429 handler(*sys.exc_info())
430 buff.write('')
431
432 handler = VerboseTB(ostream=buff)
433 buff.write('*** VerboseTB ***')
434 try:
435 buff.write(spam(1, (2, 3)))
436 except:
437 handler(*sys.exc_info())
438 buff.write('')
439
440from IPython.testing.decorators import skipif
441

Callers

nothing calls this directly

Calls 4

ColorTBClass · 0.90
VerboseTBClass · 0.90
spamFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected