Open
Description
I wonder whether PT012 is valid for generators, as one need to resolve them.
in a regular generator i can put list()
or next()
around it and for async, anext
works or putting it into a list comprehension.
@pytest.mark.asyncio
async def test_foo():
with pytest.raises(Bar): # W: `pytest.raises()` block should contain a single simple statement
async for entry in foo():
assert not entry
So you might consider it invalid, but please consider if a exception makes sense here.