From: Giampaolo Rodola' Date: Sat, 26 Nov 2011 11:17:42 +0000 (+0100) Subject: sched.py: fix test_queue by making sure that queue property returns an orderd list... X-Git-Tag: v3.3.0a1~727 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6a5dcd4b2aa3f4c39749056750329cd69d849435;p=thirdparty%2FPython%2Fcpython.git sched.py: fix test_queue by making sure that queue property returns an orderd list of upcoming events --- diff --git a/Lib/test/test_sched.py b/Lib/test/test_sched.py index 1af43cbaea6d..f5e159d68787 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 = []