[Python-checkins] cpython (merge 3.5 -> default): Issue 24004: Add a unittest for @asyncio.coroutine supporting Awaitables
yury.selivanov
python-checkins at python.org
Sun May 31 03:05:09 CEST 2015
https://hg.python.org/cpython/rev/9d261141eb0c
changeset: 96414:9d261141eb0c
parent: 96412:6c53591d589b
parent: 96413:5f1e24f083c7
user: Yury Selivanov <yselivanov at sprymix.com>
date: Sat May 30 21:04:58 2015 -0400
summary:
Issue 24004: Add a unittest for @asyncio.coroutine supporting Awaitables
(Merge 3.5)
files:
Lib/test/test_asyncio/test_pep492.py | 13 +++++++++++++
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
--- a/Lib/test/test_asyncio/test_pep492.py
+++ b/Lib/test/test_asyncio/test_pep492.py
@@ -106,6 +106,19 @@
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()
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list