Commit be53f123 authored by Stefan Behnel's avatar Stefan Behnel

Add an explicit test for async-def functions with decorators.

Closes GH-1462.
parent 758aaad0
# cython: language_level=3 # cython: language_level=3
# mode: run # mode: run
# tag: pep492, pure3.5 # tag: pep492, pure3.5, gh1462, async, await
async def test_coroutine_frame(awaitable): async def test_coroutine_frame(awaitable):
...@@ -28,3 +28,33 @@ async def test_coroutine_frame(awaitable): ...@@ -28,3 +28,33 @@ async def test_coroutine_frame(awaitable):
""" """
b = await awaitable b = await awaitable
return b return b
# gh1462: Using decorators on coroutines.
def pass_through(func):
return func
@pass_through
async def test_pass_through():
"""
>>> t = test_pass_through()
>>> try: t.send(None)
... except StopIteration as ex:
... print(ex.args[0] if ex.args else None)
... else: print("NOT STOPPED!")
None
"""
@pass_through(pass_through)
async def test_pass_through_with_args():
"""
>>> t = test_pass_through_with_args()
>>> try: t.send(None)
... except StopIteration as ex:
... print(ex.args[0] if ex.args else None)
... else: print("NOT STOPPED!")
None
"""
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment