diff options
author | Giampaolo Rodola' <g.rodola@gmail.com> | 2011-11-26 11:17:42 (GMT) |
---|---|---|
committer | Giampaolo Rodola' <g.rodola@gmail.com> | 2011-11-26 11:17:42 (GMT) |
commit | 6a5dcd4b2aa3f4c39749056750329cd69d849435 (patch) | |
tree | 1afe601becc1605401f8f789ea1b0b6f09312363 /Lib | |
parent | 2966f10ec0a75ae62947df08c7a83ba50e766750 (diff) | |
download | cpython-6a5dcd4b2aa3f4c39749056750329cd69d849435.zip cpython-6a5dcd4b2aa3f4c39749056750329cd69d849435.tar.gz cpython-6a5dcd4b2aa3f4c39749056750329cd69d849435.tar.bz2 |
sched.py: fix test_queue by making sure that queue property returns an orderd list of upcoming events
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_sched.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Lib/test/test_sched.py b/Lib/test/test_sched.py index 1af43cb..f5e159d 100644 --- a/Lib/test/test_sched.py +++ b/Lib/test/test_sched.py @@ -62,15 +62,16 @@ class TestCase(unittest.TestCase): def test_queue(self): l = [] - events = [] fun = lambda x: l.append(x) scheduler = sched.scheduler(time.time, time.sleep) - self.assertEqual(scheduler._queue, []) - for x in [0.05, 0.04, 0.03, 0.02, 0.01]: - events.append(scheduler.enterabs(x, 1, fun, (x,))) - self.assertEqual(scheduler._queue.sort(), events.sort()) - scheduler.run() - self.assertEqual(scheduler._queue, []) + e5 = scheduler.enter(0.05, 1, fun) + e1 = scheduler.enter(0.01, 1, fun) + e2 = scheduler.enter(0.02, 1, fun) + e4 = scheduler.enter(0.04, 1, fun) + e3 = scheduler.enter(0.03, 1, fun) + # queue property is supposed to return an order list of + # upcoming events + self.assertEqual(list(scheduler.queue), [e1, e2, e3, e4, e5]) def test_args_kwargs(self): flag = [] |