| 374 | class TestResetErrors(TestCase): |
| 375 | |
| 376 | def test_reset_redefine(self): |
| 377 | |
| 378 | @magics_class |
| 379 | class KernelMagics(Magics): |
| 380 | @line_magic |
| 381 | def less(self, shell): pass |
| 382 | |
| 383 | _ip.register_magics(KernelMagics) |
| 384 | |
| 385 | with self.assertLogs() as cm: |
| 386 | # hack, we want to just capture logs, but assertLogs fails if not |
| 387 | # logs get produce. |
| 388 | # so log one things we ignore. |
| 389 | import logging as log_mod |
| 390 | log = log_mod.getLogger() |
| 391 | log.info('Nothing') |
| 392 | # end hack. |
| 393 | _ip.run_cell("reset -f") |
| 394 | |
| 395 | assert len(cm.output) == 1 |
| 396 | for out in cm.output: |
| 397 | assert "Invalid alias" not in out |
| 398 | |
| 399 | def test_tb_syntaxerror(): |
| 400 | """test %tb after a SyntaxError""" |