Test %%timeit with IPython special syntax
()
| 653 | |
| 654 | |
| 655 | def test_timeit_special_syntax(): |
| 656 | "Test %%timeit with IPython special syntax" |
| 657 | @register_line_magic |
| 658 | def lmagic(line): |
| 659 | ip = get_ipython() |
| 660 | ip.user_ns['lmagic_out'] = line |
| 661 | |
| 662 | # line mode test |
| 663 | _ip.run_line_magic('timeit', '-n1 -r1 %lmagic my line') |
| 664 | nt.assert_equal(_ip.user_ns['lmagic_out'], 'my line') |
| 665 | # cell mode test |
| 666 | _ip.run_cell_magic('timeit', '-n1 -r1', '%lmagic my line2') |
| 667 | nt.assert_equal(_ip.user_ns['lmagic_out'], 'my line2') |
| 668 | |
| 669 | def test_timeit_return(): |
| 670 | """ |
nothing calls this directly
no test coverage detected