MCPcopy Index your code
hub / github.com/ipython/ipython / test_timeit

Method test_timeit

tests/test_interactiveshell.py:902–917  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

900 assert self.calls == []
901
902 def test_timeit(self):
903 called = set()
904
905 def f(x):
906 called.add(x)
907
908 ip.push({"f": f})
909
910 with tt.AssertPrints("std. dev. of"):
911 ip.run_line_magic("timeit", "-n1 f(1)")
912 self.assertEqual(called, {(1,)})
913 called.clear()
914
915 with tt.AssertPrints("std. dev. of"):
916 ip.run_cell_magic("timeit", "-n1 f(2)", "f(3)")
917 self.assertEqual(called, {(2,), (3,)})
918
919
920class ErrorTransformer(ast.NodeTransformer):

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