##// END OF EJS Templates
Calculate worst time in timeit unconditionally...
Ivan Timokhin -
Show More
@@ -1041,10 +1041,12 b' python-profiler package from non-free.""")'
1041 number *= 10
1041 number *= 10
1042 all_runs = timer.repeat(repeat, number)
1042 all_runs = timer.repeat(repeat, number)
1043 best = min(all_runs) / number
1043 best = min(all_runs) / number
1044 if not quiet :
1044
1045 worst = max(all_runs) / number
1045 worst = max(all_runs) / number
1046 if worst_tuning:
1046 if worst_tuning:
1047 worst = max(worst, worst_tuning)
1047 worst = max(worst, worst_tuning)
1048
1049 if not quiet :
1048 # Check best timing is greater than zero to avoid a
1050 # Check best timing is greater than zero to avoid a
1049 # ZeroDivisionError.
1051 # ZeroDivisionError.
1050 # In cases where the slowest timing is lesser than a micosecond
1052 # In cases where the slowest timing is lesser than a micosecond
@@ -568,6 +568,11 b' def test_timeit_quiet():'
568 with tt.AssertNotPrints("loops"):
568 with tt.AssertNotPrints("loops"):
569 _ip.run_cell("%timeit -n1 -r1 -q 1")
569 _ip.run_cell("%timeit -n1 -r1 -q 1")
570
570
571 def test_timeit_return_quiet():
572 with tt.AssertNotPrints("loops"):
573 res = _ip.run_line_magic('timeit', '-n1 -r1 -q -o 1')
574 assert (res is not None)
575
571 @dec.skipif(sys.version_info[0] >= 3, "no differences with __future__ in py3")
576 @dec.skipif(sys.version_info[0] >= 3, "no differences with __future__ in py3")
572 def test_timeit_futures():
577 def test_timeit_futures():
573 "Test %timeit with __future__ environments"
578 "Test %timeit with __future__ environments"
General Comments 0
You need to be logged in to leave comments. Login now