()
| 120 | future2.cancel() |
| 121 | |
| 122 | async def test_race_with_wait_for_timeout(): |
| 123 | print("test_race_with_wait_for_timeout") |
| 124 | future1 = Future() |
| 125 | |
| 126 | task = asyncio.create_task(resolve_later(future1, "completed first", 2)) |
| 127 | |
| 128 | # Attempt to race the futures with a timeout shorter than their resolution time |
| 129 | try: |
| 130 | race_future = Future.race([future1]) |
| 131 | await asyncio.wait_for(race_future, timeout=1) # Timeout is set deliberately short |
| 132 | assert False, "Expected a timeout but race_future completed" |
| 133 | except asyncio.TimeoutError: |
| 134 | # Expected outcome, the race_future should not complete within the timeout |
| 135 | assert True |
| 136 | await task |
| 137 | |
| 138 | async def test_race_with_wait_for_completion(): |
| 139 | print("test_race_with_wait_for_completion") |
no test coverage detected
searching dependent graphs…