aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_asyncio/test_futures2.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_futures2.py b/Lib/test/test_asyncio/test_futures2.py
new file mode 100644
index 00000000000..13dbc703277
--- /dev/null
+++ b/Lib/test/test_asyncio/test_futures2.py
@@ -0,0 +1,18 @@
+# IsolatedAsyncioTestCase based tests
+import asyncio
+import unittest
+
+
+class FutureTests(unittest.IsolatedAsyncioTestCase):
+ async def test_recursive_repr_for_pending_tasks(self):
+ # The call crashes if the guard for recursive call
+ # in base_futures:_future_repr_info is absent
+ # See Also: https://bugs.python.org/issue42183
+
+ async def func():
+ return asyncio.all_tasks()
+
+ # The repr() call should not raise RecursiveError at first.
+ # The check for returned string is not very reliable but
+ # exact comparison for the whole string is even weaker.
+ self.assertIn('...', repr(await asyncio.wait_for(func(), timeout=10)))