circuitpython/tests/basics/async_coroutine.py
Kenny 51a79b1af7 add coroutine behavior for generators
coroutines don't have __next__; they also call themselves coroutines.
This does not change the fact that `async def` methods are generators,
but it does make them behave more like CPython.
2020-07-23 20:40:16 -07:00

14 lines
267 B
Python

async def f():
pass
try:
f() # Should not crash
except Exception as e:
print('failed to invoke')
try:
next(f())
print('This should fail because async def returns a coroutine, and next() is not allowed')
except Exception as e:
print('pass')