1# IsolatedAsyncioTestCase based tests 2import asyncio 3import unittest 4 5 6class FutureTests(unittest.IsolatedAsyncioTestCase): 7 async def test_recursive_repr_for_pending_tasks(self): 8 # The call crashes if the guard for recursive call 9 # in base_futures:_future_repr_info is absent 10 # See Also: https://bugs.python.org/issue42183 11 12 async def func(): 13 return asyncio.all_tasks() 14 15 # The repr() call should not raise RecursiveError at first. 16 # The check for returned string is not very reliable but 17 # exact comparison for the whole string is even weaker. 18 self.assertIn('...', repr(await asyncio.wait_for(func(), timeout=10))) 19