micropython/tests/basics/async_with.py

18 wiersze
319 B
Python
Czysty Zwykły widok Historia

# test simple async with execution
class AContext:
async def __aenter__(self):
print('enter')
async def __aexit__(self, exc_type, exc, tb):
print('exit')
async def f():
async with AContext():
print('body')
o = f()
try:
o.send(None)
except StopIteration:
print('finished')