##// END OF EJS Templates
Add a test for reset behavior
Matthias Bussonnier -
Show More
@@ -371,6 +371,31 b' def test_reset_in_length():'
371 _ip.run_cell("reset -f in")
371 _ip.run_cell("reset -f in")
372 nt.assert_equal(len(_ip.user_ns['In']), _ip.displayhook.prompt_count+1)
372 nt.assert_equal(len(_ip.user_ns['In']), _ip.displayhook.prompt_count+1)
373
373
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
374 def test_tb_syntaxerror():
399 def test_tb_syntaxerror():
375 """test %tb after a SyntaxError"""
400 """test %tb after a SyntaxError"""
376 ip = get_ipython()
401 ip = get_ipython()
General Comments 0
You need to be logged in to leave comments. Login now