git reimport
This commit is contained in:
28
tests/zvk/event/test_async_gen.py
Normal file
28
tests/zvk/event/test_async_gen.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import pytest
|
||||
|
||||
from zvk.util.zlogging import logger
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_async_gen():
|
||||
async def f1():
|
||||
logger.info('hi 1')
|
||||
|
||||
async def f2():
|
||||
logger.info('hi 2')
|
||||
yield 1
|
||||
|
||||
async def f3():
|
||||
logger.info('hi 3')
|
||||
if False:
|
||||
yield 1
|
||||
|
||||
with pytest.raises(Exception):
|
||||
async for i in f1():
|
||||
assert i == 1
|
||||
|
||||
async for i in f2():
|
||||
assert i == 1
|
||||
|
||||
async for i in f3():
|
||||
assert i == 1
|
Reference in New Issue
Block a user