test %tb after a SyntaxError
()
| 397 | assert "Invalid alias" not in out |
| 398 | |
| 399 | def 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 | |
| 417 | def test_time(): |
nothing calls this directly
no test coverage detected