| 385 | |
| 386 | class TestResetErrors(TestCase): |
| 387 | def test_reset_redefine(self): |
| 388 | @magics_class |
| 389 | class KernelMagics(Magics): |
| 390 | @line_magic |
| 391 | def less(self, shell): |
| 392 | pass |
| 393 | |
| 394 | _ip.register_magics(KernelMagics) |
| 395 | |
| 396 | with self.assertLogs() as cm: |
| 397 | # hack, we want to just capture logs, but assertLogs fails if not |
| 398 | # logs get produce. |
| 399 | # so log one things we ignore. |
| 400 | import logging as log_mod |
| 401 | |
| 402 | log = log_mod.getLogger() |
| 403 | log.info("Nothing") |
| 404 | # end hack. |
| 405 | _ip.run_cell("reset -f") |
| 406 | |
| 407 | assert len(cm.output) == 1 |
| 408 | for out in cm.output: |
| 409 | assert "Invalid alias" not in out |
| 410 | |
| 411 | |
| 412 | def test_tb_syntaxerror(): |