Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@aiomisc.timeout(1)
async def test_select_cancel_true(loop: asyncio.AbstractEventLoop):
event1 = asyncio.Event()
event2 = asyncio.Event()
event3 = asyncio.Event()
async def coro1():
await event1.wait()
event2.set()
async def coro2():
await asyncio.sleep(0)
event3.set()
await aiomisc.select(coro2(), coro1(), cancel=True)
assert not event1.is_set()
assert not event2.is_set()
@aiomisc.timeout(1)
async def test_select_cancel_false(loop: asyncio.AbstractEventLoop):
event1 = asyncio.Event()
event2 = asyncio.Event()
event3 = asyncio.Event()
async def coro1():
await event1.wait()
event2.set()
async def coro2():
event1.set()
await event2.wait()
event3.set()
await aiomisc.select(coro2(), coro1(), cancel=False)
await event3.wait()
@aiomisc.timeout(0)
def test():
return
@aiomisc.timeout(0)
async def test():
await asyncio.sleep(0.05)
@aiomisc.timeout(0.5)
async def test(sec):
await asyncio.sleep(sec)