summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBar Harel <bzvi7919@gmail.com>2020-10-19 07:33:43 (GMT)
committerGitHub <noreply@github.com>2020-10-19 07:33:43 (GMT)
commit5368c2b6e23660cbce7e38dc68f859c66ac349ee (patch)
treee578050496dd95207d5e4b6a97b05cb47697c7fb /Lib/test
parent155938907c2b3df71608ddeaa0a43d2ec1f2c699 (diff)
downloadcpython-5368c2b6e23660cbce7e38dc68f859c66ac349ee.zip
cpython-5368c2b6e23660cbce7e38dc68f859c66ac349ee.tar.gz
cpython-5368c2b6e23660cbce7e38dc68f859c66ac349ee.tar.bz2
bpo-19270: Fixed sched.scheduler.cancel to cancel correct event (GH-22729)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_sched.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_sched.py b/Lib/test/test_sched.py
index 491d7b3..7ae7baa 100644
--- a/Lib/test/test_sched.py
+++ b/Lib/test/test_sched.py
@@ -142,6 +142,17 @@ class TestCase(unittest.TestCase):
self.assertTrue(q.empty())
self.assertEqual(timer.time(), 4)
+ def test_cancel_correct_event(self):
+ # bpo-19270
+ events = []
+ scheduler = sched.scheduler()
+ scheduler.enterabs(1, 1, events.append, ("a",))
+ b = scheduler.enterabs(1, 1, events.append, ("b",))
+ scheduler.enterabs(1, 1, events.append, ("c",))
+ scheduler.cancel(b)
+ scheduler.run()
+ self.assertEqual(events, ["a", "c"])
+
def test_empty(self):
l = []
fun = lambda x: l.append(x)