summaryrefslogtreecommitdiff
path: root/tests/run/test_asyncgen.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run/test_asyncgen.py')
-rw-r--r--tests/run/test_asyncgen.py82
1 files changed, 41 insertions, 41 deletions
diff --git a/tests/run/test_asyncgen.py b/tests/run/test_asyncgen.py
index 9b95a6201..410d4fe0b 100644
--- a/tests/run/test_asyncgen.py
+++ b/tests/run/test_asyncgen.py
@@ -534,9 +534,9 @@ class AsyncGenAsyncioTest(unittest.TestCase):
def test_async_gen_asyncio_01(self):
async def gen():
yield 1
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
yield 2
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
return
yield 3
@@ -546,7 +546,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
def test_async_gen_asyncio_02(self):
async def gen():
yield 1
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
yield 2
1 / ZERO
yield 3
@@ -560,7 +560,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
class Gen:
async def __aiter__(self):
yield 1
- await asyncio.sleep(0.01, loop=loop)
+ await asyncio.sleep(0.01)
yield 2
res = loop.run_until_complete(self.to_list(Gen()))
@@ -569,13 +569,13 @@ class AsyncGenAsyncioTest(unittest.TestCase):
def test_async_gen_asyncio_anext_04(self):
async def foo():
yield 1
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
try:
yield 2
yield 3
except ZeroDivisionError:
yield 1000
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
yield 4
async def run1():
@@ -726,7 +726,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
yield 1
1 / ZERO
finally:
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
yield 12
async def run():
@@ -749,8 +749,8 @@ class AsyncGenAsyncioTest(unittest.TestCase):
yield 1
1 / ZERO
finally:
- await asyncio.sleep(0.01, loop=self.loop)
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
+ await asyncio.sleep(0.01)
DONE += 1
DONE += 1000
@@ -776,8 +776,8 @@ class AsyncGenAsyncioTest(unittest.TestCase):
DONE += 1000
yield 2
finally:
- await asyncio.sleep(0.01, loop=self.loop)
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
+ await asyncio.sleep(0.01)
DONE += 1
DONE += 1000
@@ -792,7 +792,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
# Silence ResourceWarnings
fut.cancel()
- self.loop.run_until_complete(asyncio.sleep(0.01, loop=self.loop))
+ self.loop.run_until_complete(asyncio.sleep(0.01))
@needs_py36_asyncio
def test_async_gen_asyncio_gc_aclose_09(self):
@@ -804,8 +804,8 @@ class AsyncGenAsyncioTest(unittest.TestCase):
while True:
yield 1
finally:
- await asyncio.sleep(0.01, loop=self.loop)
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
+ await asyncio.sleep(0.01)
DONE = 1
async def run():
@@ -814,7 +814,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
await g.__anext__()
del g
- await asyncio.sleep(0.2, loop=self.loop)
+ await asyncio.sleep(0.2)
self.loop.run_until_complete(run())
self.assertEqual(DONE, 1)
@@ -932,15 +932,15 @@ class AsyncGenAsyncioTest(unittest.TestCase):
async def gen():
nonlocal DONE
try:
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
v = yield 1
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
yield v * 2
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
return
finally:
- await asyncio.sleep(0.01, loop=self.loop)
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
+ await asyncio.sleep(0.01)
DONE = 1
async def run():
@@ -962,21 +962,21 @@ class AsyncGenAsyncioTest(unittest.TestCase):
DONE = 0
async def sleep_n_crash(delay):
- await asyncio.sleep(delay, loop=self.loop)
+ await asyncio.sleep(delay)
1 / ZERO
async def gen():
nonlocal DONE
try:
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
v = yield 1
await sleep_n_crash(0.01)
DONE += 1000
yield v * 2
finally:
assert sys.exc_info()[0] == ZeroDivisionError
- await asyncio.sleep(0.01, loop=self.loop)
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
+ await asyncio.sleep(0.01)
DONE += 1
async def run():
@@ -995,7 +995,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
DONE = 0
async def sleep_n_crash(delay):
- fut = asyncio.ensure_future(asyncio.sleep(delay, loop=self.loop),
+ fut = asyncio.ensure_future(asyncio.sleep(delay),
loop=self.loop)
self.loop.call_later(delay / 2, lambda: fut.cancel())
return await fut
@@ -1003,14 +1003,14 @@ class AsyncGenAsyncioTest(unittest.TestCase):
async def gen():
nonlocal DONE
try:
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
v = yield 1
await sleep_n_crash(0.01)
DONE += 1000
yield v * 2
finally:
- await asyncio.sleep(0.01, loop=self.loop)
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
+ await asyncio.sleep(0.01)
DONE = 1
async def run():
@@ -1049,18 +1049,18 @@ class AsyncGenAsyncioTest(unittest.TestCase):
async def gen():
nonlocal DONE
try:
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
try:
v = yield 1
except FooEr:
v = 1000
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
yield v * 2
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
# return
finally:
- await asyncio.sleep(0.01, loop=self.loop)
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
+ await asyncio.sleep(0.01)
DONE = 1
async def run():
@@ -1085,7 +1085,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
pass
async def sleep_n_crash(delay):
- fut = asyncio.ensure_future(asyncio.sleep(delay, loop=self.loop),
+ fut = asyncio.ensure_future(asyncio.sleep(delay),
loop=self.loop)
self.loop.call_later(delay / 2, lambda: fut.cancel())
return await fut
@@ -1093,17 +1093,17 @@ class AsyncGenAsyncioTest(unittest.TestCase):
async def gen():
nonlocal DONE
try:
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
try:
v = yield 1
except FooEr:
await sleep_n_crash(0.01)
yield v * 2
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
# return
finally:
- await asyncio.sleep(0.01, loop=self.loop)
- await asyncio.sleep(0.01, loop=self.loop)
+ await asyncio.sleep(0.01)
+ await asyncio.sleep(0.01)
DONE = 1
async def run():
@@ -1203,10 +1203,10 @@ class AsyncGenAsyncioTest(unittest.TestCase):
async def waiter(timeout):
nonlocal finalized
try:
- await asyncio.sleep(timeout, loop=self.loop)
+ await asyncio.sleep(timeout)
yield 1
finally:
- await asyncio.sleep(0, loop=self.loop)
+ await asyncio.sleep(0)
finalized += 1
async def wait():
@@ -1216,7 +1216,7 @@ class AsyncGenAsyncioTest(unittest.TestCase):
t1 = self.loop.create_task(wait())
t2 = self.loop.create_task(wait())
- self.loop.run_until_complete(asyncio.sleep(0.1, loop=self.loop))
+ self.loop.run_until_complete(asyncio.sleep(0.1))
# Silence warnings