##// END OF EJS Templates
Extend the previous test to cover both line and cell modes.
Fernando Perez -
Show More
@@ -450,8 +450,8 b' def test_timeit_arguments():'
450 _ip.magic("timeit ('#')")
450 _ip.magic("timeit ('#')")
451
451
452
452
453 def test_timeit_cell():
453 def test_timeit_special_syntax():
454 "Test %%timeit called in cell mode"
454 "Test %%timeit with IPython special syntax"
455 from IPython.core.magic import register_line_magic
455 from IPython.core.magic import register_line_magic
456
456
457 @register_line_magic
457 @register_line_magic
@@ -459,8 +459,12 b' def test_timeit_cell():'
459 ip = get_ipython()
459 ip = get_ipython()
460 ip.user_ns['lmagic_out'] = line
460 ip.user_ns['lmagic_out'] = line
461
461
462 _ip.run_cell_magic('timeit', '-n1 -r1', '%lmagic my line')
462 # line mode test
463 _ip.run_line_magic('timeit', '-n1 -r1 %lmagic my line')
463 nt.assert_equal(_ip.user_ns['lmagic_out'], 'my line')
464 nt.assert_equal(_ip.user_ns['lmagic_out'], 'my line')
465 # cell mode test
466 _ip.run_cell_magic('timeit', '-n1 -r1', '%lmagic my line2')
467 nt.assert_equal(_ip.user_ns['lmagic_out'], 'my line2')
464
468
465
469
466 @dec.skipif(execution.profile is None)
470 @dec.skipif(execution.profile is None)
General Comments 0
You need to be logged in to leave comments. Login now