summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_tasks.py
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2022-04-01 01:25:15 (GMT)
committerGitHub <noreply@github.com>2022-04-01 01:25:15 (GMT)
commitd4bb38f82bf18b00db3129031ce4969b6f0caab9 (patch)
treeafdf80168076e324404d2ce492b5a222868b4d19 /Lib/test/test_asyncio/test_tasks.py
parentab89ccff3ca6efc2a8e6f5f45c30d568fb3d212f (diff)
downloadcpython-d4bb38f82bf18b00db3129031ce4969b6f0caab9.zip
cpython-d4bb38f82bf18b00db3129031ce4969b6f0caab9.tar.gz
cpython-d4bb38f82bf18b00db3129031ce4969b6f0caab9.tar.bz2
bpo-47167: Allow overriding a future compliance check in asyncio.Task (GH-32197)
Diffstat (limited to 'Lib/test/test_asyncio/test_tasks.py')
-rw-r--r--Lib/test/test_asyncio/test_tasks.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py
index 8df1957..80afb27 100644
--- a/Lib/test/test_asyncio/test_tasks.py
+++ b/Lib/test/test_asyncio/test_tasks.py
@@ -2383,7 +2383,13 @@ def add_subclass_tests(cls):
return super().add_done_callback(*args, **kwargs)
class Task(CommonFuture, BaseTask):
- pass
+ def __init__(self, *args, **kwargs):
+ self._check_future_called = 0
+ super().__init__(*args, **kwargs)
+
+ def _check_future(self, future):
+ self._check_future_called += 1
+ return super()._check_future(future)
class Future(CommonFuture, BaseFuture):
pass
@@ -2409,6 +2415,8 @@ def add_subclass_tests(cls):
dict(fut.calls),
{'add_done_callback': 1})
+ self.assertEqual(1, task._check_future_called)
+
# Add patched Task & Future back to the test case
cls.Task = Task
cls.Future = Future