MCPcopy Create free account
hub / github.com/ipython/ipython / test_timeit

Method test_timeit

IPython/core/tests/test_interactiveshell.py:650–663  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

648 ip.run_cell('print (n)')
649
650 def test_timeit(self):
651 called = set()
652 def f(x):
653 called.add(x)
654 ip.push({'f':f})
655
656 with tt.AssertPrints("std. dev. of"):
657 ip.run_line_magic("timeit", "-n1 f(1)")
658 self.assertEqual(called, {-1})
659 called.clear()
660
661 with tt.AssertPrints("std. dev. of"):
662 ip.run_cell_magic("timeit", "-n1 f(2)", "f(3)")
663 self.assertEqual(called, {-2, -3})
664
665 def test_time(self):
666 called = []

Callers

nothing calls this directly

Calls 3

run_line_magicMethod · 0.80
run_cell_magicMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected