|
@@ -520,15 +520,15 @@ async def test_asyncio_utils():
|
|
|
assert await afirst(as_aiter(), -1) == -1
|
|
|
assert await afirst(as_aiter(1, 2, 3)) == 1
|
|
|
|
|
|
- async def iterate(delays):
|
|
|
+ async def iterate_with_delays(delays):
|
|
|
for i, delay in enumerate(delays):
|
|
|
await asyncio.sleep(delay)
|
|
|
yield i
|
|
|
|
|
|
- async for _ in aiter_with_timeout(iterate([0.1] * 5), timeout=0.2):
|
|
|
+ async for _ in aiter_with_timeout(iterate_with_delays([0.1] * 5), timeout=0.2):
|
|
|
pass
|
|
|
|
|
|
- sleepy_aiter = iterate([0.1, 0.1, 0.3, 0.1, 0.1])
|
|
|
+ sleepy_aiter = iterate_with_delays([0.1, 0.1, 0.3, 0.1, 0.1])
|
|
|
num_steps = 0
|
|
|
with pytest.raises(asyncio.TimeoutError):
|
|
|
async for _ in aiter_with_timeout(sleepy_aiter, timeout=0.2):
|