aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_asyncio/test_tasks.py
diff options
context:
space:
mode:
authorYury Selivanov <yury@edgedb.com>2019-09-25 03:32:08 -0700
committerCarol Willing <carolcode@willingconsulting.com>2019-09-25 03:32:08 -0700
commitedad4d89e357c92f70c0324b937845d652b20afd (patch)
tree98cea6eaaf38962883784942aba23160b009360f /Lib/test/test_asyncio/test_tasks.py
parentc64af8fad3c4f5751af624647fbb0ce023f525dc (diff)
downloadcpython-edad4d89e357c92f70c0324b937845d652b20afd.tar.gz
cpython-edad4d89e357c92f70c0324b937845d652b20afd.zip
bpo-38248: Fix inconsistent immediate asyncio.Task cancellation (GH-16330)
Diffstat (limited to 'Lib/test/test_asyncio/test_tasks.py')
-rw-r--r--Lib/test/test_asyncio/test_tasks.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py
index 576714faa88..dde84b84b10 100644
--- a/Lib/test/test_asyncio/test_tasks.py
+++ b/Lib/test/test_asyncio/test_tasks.py
@@ -604,9 +604,11 @@ class BaseTaskTests:
return 12
t = self.new_task(loop, task())
+ self.assertFalse(t.cancelled())
self.assertRaises(
asyncio.CancelledError, loop.run_until_complete, t)
self.assertTrue(t.done())
+ self.assertTrue(t.cancelled())
self.assertFalse(t._must_cancel) # White-box test.
self.assertFalse(t.cancel())
@@ -621,9 +623,11 @@ class BaseTaskTests:
return 12
t = self.new_task(loop, task())
+ self.assertFalse(t.cancelled())
self.assertRaises(
asyncio.CancelledError, loop.run_until_complete, t)
self.assertTrue(t.done())
+ self.assertTrue(t.cancelled())
self.assertFalse(t._must_cancel) # White-box test.
self.assertFalse(t.cancel())