Test %%timeit with IPython special syntax
()
| 886 | |
| 887 | |
| 888 | def test_timeit_special_syntax(): |
| 889 | "Test %%timeit with IPython special syntax" |
| 890 | |
| 891 | @register_line_magic |
| 892 | def lmagic(line): |
| 893 | ip = get_ipython() |
| 894 | ip.user_ns["lmagic_out"] = line |
| 895 | |
| 896 | # line mode test |
| 897 | _ip.run_line_magic("timeit", "-n1 -r1 %lmagic my line") |
| 898 | assert _ip.user_ns["lmagic_out"] == "my line" |
| 899 | # cell mode test |
| 900 | _ip.run_cell_magic("timeit", "-n1 -r1", "%lmagic my line2") |
| 901 | assert _ip.user_ns["lmagic_out"] == "my line2" |
| 902 | |
| 903 | |
| 904 | def test_timeit_return(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…