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

Method test_time

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

Source from the content-addressed store, hash-verified

799 self.assertEqual(called, {-2, -3})
800
801 def test_time(self):
802 called = []
803
804 def f(x):
805 called.append(x)
806
807 ip.push({"f": f})
808
809 # Test with an expression
810 with tt.AssertPrints("Wall time: "):
811 ip.run_line_magic("time", "f(5+9)")
812 self.assertEqual(called, [-14])
813 called[:] = []
814
815 # Test with a statement (different code path)
816 with tt.AssertPrints("Wall time: "):
817 ip.run_line_magic("time", "a = f(-3 + -2)")
818 self.assertEqual(called, [5])
819
820 def test_macro(self):
821 ip.push({"a": 10})

Callers

nothing calls this directly

Calls 2

run_line_magicMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected