Fix 13245:

sched.scheduler class constructor's timefunc and delayfunct parameters are now optional.
scheduler.enter and scheduler.enterabs methods gained a new kwargs parameter.

Patch contributed by Matt Mulsow.
This commit is contained in:
Giampaolo Rodola' 2011-11-22 13:33:34 +01:00
parent ca4f20782e
commit be55d99b3d
6 changed files with 64 additions and 14 deletions

View file

@ -72,6 +72,18 @@ class TestCase(unittest.TestCase):
scheduler.run()
self.assertEqual(scheduler._queue, [])
def test_args_kwargs(self):
flag = []
def fun(*a, **b):
flag.append(None)
self.assertEqual(a, (1,2,3))
self.assertEqual(b, {"foo":1})
scheduler = sched.scheduler(time.time, time.sleep)
z = scheduler.enterabs(0.01, 1, fun, argument=(1,2,3), kwargs={"foo":1})
scheduler.run()
self.assertEqual(flag, [None])
def test_main():
support.run_unittest(TestCase)