MCPcopy Index your code
hub / github.com/python/cpython / test_timer

Method test_timer

Lib/test/test_asyncio/test_events.py:2594–2609  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2592 self.assertEqual(when, h.when())
2593
2594 def test_timer(self):
2595 def callback(*args):
2596 return args
2597
2598 args = (1, 2, 3)
2599 when = time.monotonic()
2600 h = asyncio.TimerHandle(when, callback, args, mock.Mock())
2601 self.assertIs(h._callback, callback)
2602 self.assertIs(h._args, args)
2603 self.assertFalse(h.cancelled())
2604
2605 # cancel
2606 h.cancel()
2607 self.assertTrue(h.cancelled())
2608 self.assertIsNone(h._callback)
2609 self.assertIsNone(h._args)
2610
2611
2612 def test_timer_repr(self):

Callers

nothing calls this directly

Calls 6

cancelMethod · 0.95
assertFalseMethod · 0.80
assertTrueMethod · 0.80
assertIsNoneMethod · 0.80
assertIsMethod · 0.45
cancelledMethod · 0.45

Tested by

no test coverage detected