diff options
Diffstat (limited to 'tests/basics/async_with.py')
-rw-r--r-- | tests/basics/async_with.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/basics/async_with.py b/tests/basics/async_with.py index 742f9ba99..5af0c5d95 100644 --- a/tests/basics/async_with.py +++ b/tests/basics/async_with.py @@ -3,8 +3,9 @@ class AContext: async def __aenter__(self): print('enter') + return 1 async def __aexit__(self, exc_type, exc, tb): - print('exit') + print('exit', exc_type, exc) async def f(): async with AContext(): @@ -15,3 +16,14 @@ try: o.send(None) except StopIteration: print('finished') + +async def g(): + async with AContext() as ac: + print(ac) + raise ValueError('error') + +o = g() +try: + o.send(None) +except ValueError: + print('ValueError') |