mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
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:
parent
ca4f20782e
commit
be55d99b3d
6 changed files with 64 additions and 14 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue