summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/async_with.py
blob: 742f9ba993e7bcac1c0717e097564002c925dcc5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 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')