Show More
@@ -381,6 +381,17 b' def test_time3():' | |||||
381 | "run = 0\n" |
|
381 | "run = 0\n" | |
382 | "run += 1") |
|
382 | "run += 1") | |
383 |
|
383 | |||
|
384 | @dec.skipif(sys.version_info[0] >= 3, "no differences with __future__ in py3") | |||
|
385 | def test_time_futures(): | |||
|
386 | "Test %time with __future__ environments" | |||
|
387 | ip = get_ipython() | |||
|
388 | ip.run_cell("from __future__ import division") | |||
|
389 | with tt.AssertPrints('0.25'): | |||
|
390 | ip.run_line_magic('time', 'print(1/4)') | |||
|
391 | ip.compile.reset_compiler_flags() | |||
|
392 | with tt.AssertNotPrints('0.25'): | |||
|
393 | ip.run_line_magic('time', 'print(1/4)') | |||
|
394 | ||||
384 | def test_doctest_mode(): |
|
395 | def test_doctest_mode(): | |
385 | "Toggle doctest_mode twice, it should be a no-op and run without error" |
|
396 | "Toggle doctest_mode twice, it should be a no-op and run without error" | |
386 | _ip.magic('doctest_mode') |
|
397 | _ip.magic('doctest_mode') | |
@@ -560,6 +571,17 b' def test_timeit_quiet():' | |||||
560 | with tt.AssertNotPrints("loops"): |
|
571 | with tt.AssertNotPrints("loops"): | |
561 | _ip.run_cell("%timeit -n1 -r1 -q 1") |
|
572 | _ip.run_cell("%timeit -n1 -r1 -q 1") | |
562 |
|
573 | |||
|
574 | @dec.skipif(sys.version_info[0] >= 3, "no differences with __future__ in py3") | |||
|
575 | def test_timeit_futures(): | |||
|
576 | "Test %timeit with __future__ environments" | |||
|
577 | ip = get_ipython() | |||
|
578 | ip.run_cell("from __future__ import division") | |||
|
579 | with tt.AssertPrints('0.25'): | |||
|
580 | ip.run_line_magic('timeit', '-n1 -r1 print(1/4)') | |||
|
581 | ip.compile.reset_compiler_flags() | |||
|
582 | with tt.AssertNotPrints('0.25'): | |||
|
583 | ip.run_line_magic('timeit', '-n1 -r1 print(1/4)') | |||
|
584 | ||||
563 | @dec.skipif(execution.profile is None) |
|
585 | @dec.skipif(execution.profile is None) | |
564 | def test_prun_special_syntax(): |
|
586 | def test_prun_special_syntax(): | |
565 | "Test %%prun with IPython special syntax" |
|
587 | "Test %%prun with IPython special syntax" |
General Comments 0
You need to be logged in to leave comments.
Login now