[Python-checkins] cpython (3.5): 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/5f1e24f083c7
changeset: 96413:5f1e24f083c7
branch: 3.5
parent: 96411:d1959cafc68c
user: Yury Selivanov <yselivanov at sprymix.com>
date: Sat May 30 21:04:37 2015 -0400
summary:
Issue 24004: Add a unittest for @asyncio.coroutine supporting Awaitables
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