summaryrefslogtreecommitdiff
path: root/tests/run/py35_asyncio_async_def.srctree
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run/py35_asyncio_async_def.srctree')
-rw-r--r--tests/run/py35_asyncio_async_def.srctree20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/run/py35_asyncio_async_def.srctree b/tests/run/py35_asyncio_async_def.srctree
index 457ef9dae..7843b8e16 100644
--- a/tests/run/py35_asyncio_async_def.srctree
+++ b/tests/run/py35_asyncio_async_def.srctree
@@ -1,5 +1,5 @@
# mode: run
-# tag: asyncio, gh1685
+# tag: asyncio, gh1685, gh2273
PYTHON setup.py build_ext -i
PYTHON main.py
@@ -19,6 +19,7 @@ setup(
import asyncio
import cy_test
+import py_test
from contextlib import closing
async def main():
@@ -31,6 +32,12 @@ with closing(asyncio.new_event_loop()) as loop:
print("Running Cython coroutine ...")
loop.run_until_complete(cy_test.say())
+assert asyncio.iscoroutinefunction(cy_test.cy_async_def_example) == True
+assert asyncio.iscoroutinefunction(cy_test.cy_async_def_example) == True
+assert asyncio.iscoroutinefunction(py_test.py_async_def_example) == True
+assert asyncio.iscoroutinefunction(py_test.py_async_def_example) == True
+assert asyncio.iscoroutinefunction(cy_test.cy_def_example) == False
+assert asyncio.iscoroutinefunction(py_test.py_def_example) == False
######## cy_test.pyx ########
@@ -51,8 +58,19 @@ async def cb():
await asyncio.sleep(0.5)
print("done!")
+async def cy_async_def_example():
+ return 1
+
+def cy_def_example():
+ return 1
######## py_test.py ########
async def py_async():
print("- and this one is from Python")
+
+async def py_async_def_example():
+ return 1
+
+def py_def_example():
+ return 1