summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_asyncio/test_tasks.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py
index c4f6d70..fa9783f 100644
--- a/Lib/test/test_asyncio/test_tasks.py
+++ b/Lib/test/test_asyncio/test_tasks.py
@@ -1777,7 +1777,7 @@ class BaseTaskTests:
test_utils.run_briefly(self.loop)
self.assertIs(outer.exception(), exc)
- def test_shield_cancel(self):
+ def test_shield_cancel_inner(self):
inner = self.new_future(self.loop)
outer = asyncio.shield(inner)
test_utils.run_briefly(self.loop)
@@ -1785,6 +1785,15 @@ class BaseTaskTests:
test_utils.run_briefly(self.loop)
self.assertTrue(outer.cancelled())
+ def test_shield_cancel_outer(self):
+ inner = self.new_future(self.loop)
+ outer = asyncio.shield(inner)
+ test_utils.run_briefly(self.loop)
+ outer.cancel()
+ test_utils.run_briefly(self.loop)
+ self.assertTrue(outer.cancelled())
+ self.assertEqual(0, 0 if outer._callbacks is None else len(outer._callbacks))
+
def test_shield_shortcut(self):
fut = self.new_future(self.loop)
fut.set_result(42)