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

Method test_args_kwargs

Lib/test/test_sched.py:196–213  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

194 self.assertEqual(scheduler.queue, [e1, e2, e3, e4, e5])
195
196 def test_args_kwargs(self):
197 seq = []
198 def fun(*a, **b):
199 seq.append((a, b))
200
201 now = time.time()
202 scheduler = sched.scheduler(time.time, time.sleep)
203 scheduler.enterabs(now, 1, fun)
204 scheduler.enterabs(now, 1, fun, argument=(1, 2))
205 scheduler.enterabs(now, 1, fun, argument=('a', 'b'))
206 scheduler.enterabs(now, 1, fun, argument=(1, 2), kwargs={"foo": 3})
207 scheduler.run()
208 self.assertCountEqual(seq, [
209 ((), {}),
210 ((1, 2), {}),
211 (('a', 'b'), {}),
212 ((1, 2), {'foo': 3})
213 ])
214
215 def test_run_non_blocking(self):
216 l = []

Callers

nothing calls this directly

Calls 4

assertCountEqualMethod · 0.95
enterabsMethod · 0.80
timeMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected