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

Function test_tb_syntaxerror

IPython/core/tests/test_magic.py:399–414  ·  view source on GitHub ↗

test %tb after a SyntaxError

()

Source from the content-addressed store, hash-verified

397 assert "Invalid alias" not in out
398
399def test_tb_syntaxerror():
400 """test %tb after a SyntaxError"""
401 ip = get_ipython()
402 ip.run_cell("for")
403
404 # trap and validate stdout
405 save_stdout = sys.stdout
406 try:
407 sys.stdout = StringIO()
408 ip.run_cell("%tb")
409 out = sys.stdout.getvalue()
410 finally:
411 sys.stdout = save_stdout
412 # trim output, and only check the last line
413 last_line = out.rstrip().splitlines()[-1].strip()
414 nt.assert_equal(last_line, "SyntaxError: invalid syntax")
415
416
417def test_time():

Callers

nothing calls this directly

Calls 2

get_ipythonFunction · 0.90
run_cellMethod · 0.45

Tested by

no test coverage detected