Commit 22d93590 authored by Raymond Hettinger's avatar Raymond Hettinger

Issue #5830: Add test for ee476248a74a. (Contributed by Serhiy Storchaka.)

parent 6c45d853
......@@ -172,17 +172,23 @@ class TestCase(unittest.TestCase):
self.assertEqual(scheduler.queue, [e1, e2, e3, e4, e5])
def test_args_kwargs(self):
flag = []
seq = []
def fun(*a, **b):
flag.append(None)
self.assertEqual(a, (1,2,3))
self.assertEqual(b, {"foo":1})
seq.append((a, b))
now = time.time()
scheduler = sched.scheduler(time.time, time.sleep)
z = scheduler.enterabs(0.01, 1, fun, argument=(1,2,3), kwargs={"foo":1})
scheduler.enterabs(now, 1, fun)
scheduler.enterabs(now, 1, fun, argument=(1, 2))
scheduler.enterabs(now, 1, fun, argument=('a', 'b'))
scheduler.enterabs(now, 1, fun, argument=(1, 2), kwargs={"foo": 3})
scheduler.run()
self.assertEqual(flag, [None])
self.assertCountEqual(seq, [
((), {}),
((1, 2), {}),
(('a', 'b'), {}),
((1, 2), {'foo': 3})
])
def test_run_non_blocking(self):
l = []
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment