[Python-checkins] cpython (3.6): Issue #5830: Add test for ee476248a74a. (Contributed by Serhiy Storchaka.)

raymond.hettinger python-checkins at python.org
Mon Nov 21 19:48:30 EST 2016


https://hg.python.org/cpython/rev/ecc6f7940e02
changeset: 105319:ecc6f7940e02
branch: 3.6
parent: 105317:71dd21a3b9cc
user: Raymond Hettinger <python at rcn.com>
date: Mon Nov 21 16:48:10 2016 -0800
summary:
 Issue #5830: Add test for ee476248a74a. (Contributed by Serhiy Storchaka.)
files:
 Lib/test/test_sched.py | 22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/Lib/test/test_sched.py b/Lib/test/test_sched.py
--- a/Lib/test/test_sched.py
+++ b/Lib/test/test_sched.py
@@ -172,17 +172,23 @@
 self.assertEqual(scheduler.queue, [e1, e2, e3, e4, e5])
 
 def test_args_kwargs(self):
- flag = []
+ seq = []
+ def fun(*a, **b):
+ seq.append((a, b))
 
- def fun(*a, **b):
- flag.append(None)
- self.assertEqual(a, (1,2,3))
- self.assertEqual(b, {"foo":1})
-
+ 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 = []
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /