diff options
author | Raymond Hettinger <python@rcn.com> | 2016-11-22 00:48:10 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2016-11-22 00:48:10 (GMT) |
commit | 6b3481c4edf9bdb42f78eeb2680150626db3087a (patch) | |
tree | 4b261ace396933acd6569bec9798daea49ea219e /Lib/test/test_sched.py | |
parent | 6da9078195301c3cd653e8a993cbcf91856666ff (diff) | |
download | cpython-6b3481c4edf9bdb42f78eeb2680150626db3087a.zip cpython-6b3481c4edf9bdb42f78eeb2680150626db3087a.tar.gz cpython-6b3481c4edf9bdb42f78eeb2680150626db3087a.tar.bz2 |
Issue #5830: Add test for ee476248a74a. (Contributed by Serhiy Storchaka.)
Diffstat (limited to 'Lib/test/test_sched.py')
-rw-r--r-- | Lib/test/test_sched.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/Lib/test/test_sched.py b/Lib/test/test_sched.py index f86f599..ebf8856 100644 --- a/Lib/test/test_sched.py +++ b/Lib/test/test_sched.py @@ -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 = [] |