summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2015-05-31 01:04:37 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2015-05-31 01:04:37 (GMT)
commitad583a8e6de1ea023d2b20b72a1910465ecfc82c (patch)
treefc514c099788ebc0c7e689e60c39dccfcd868808 /Lib/test/test_asyncio
parent353f2299bf1f5dc8483fcdca3689469a7079d4a1 (diff)
downloadcpython-ad583a8e6de1ea023d2b20b72a1910465ecfc82c.zip
cpython-ad583a8e6de1ea023d2b20b72a1910465ecfc82c.tar.gz
cpython-ad583a8e6de1ea023d2b20b72a1910465ecfc82c.tar.bz2
Issue 24004: Add a unittest for @asyncio.coroutine supporting Awaitables
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r--Lib/test/test_asyncio/test_pep492.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_pep492.py b/Lib/test/test_asyncio/test_pep492.py
index 8fc6cba..d123f08 100644
--- a/Lib/test/test_asyncio/test_pep492.py
+++ b/Lib/test/test_asyncio/test_pep492.py
@@ -106,6 +106,19 @@ class CoroutineTests(BaseTest):
self.assertTrue(asyncio.iscoroutine(FakeCoro()))
+ def test_function_returning_awaitable(self):
+ class Awaitable:
+ def __await__(self):
+ return ('spam',)
+
+ @asyncio.coroutine
+ def func():
+ return Awaitable()
+
+ coro = func()
+ self.assertEquals(coro.send(None), 'spam')
+ coro.close()
+
if __name__ == '__main__':
unittest.main()