[Python-checkins] cpython (merge 3.5 -> default): Issue 24017: Add a test for CoroWrapper and 'async def' coroutines

yury.selivanov python-checkins at python.org
Mon Jun 1 03:44:20 CEST 2015


https://hg.python.org/cpython/rev/89521ac669f0
changeset: 96441:89521ac669f0
parent: 96439:2e7c45560c38
parent: 96440:a0a699b828e7
user: Yury Selivanov <yselivanov at sprymix.com>
date: Sun May 31 21:44:15 2015 -0400
summary:
 Issue 24017: Add a test for CoroWrapper and 'async def' coroutines
files:
 Lib/test/test_asyncio/test_pep492.py | 14 ++++++++++++++
 1 files changed, 14 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
@@ -119,6 +119,20 @@
 self.assertEqual(coro.send(None), 'spam')
 coro.close()
 
+ def test_async_ded_coroutines(self):
+ async def bar():
+ return 'spam'
+ async def foo():
+ return await bar()
+
+ # production mode
+ data = self.loop.run_until_complete(foo())
+ self.assertEqual(data, 'spam')
+
+ # debug mode
+ self.loop.set_debug(True)
+ data = self.loop.run_until_complete(foo())
+ self.assertEqual(data, 'spam')
 
 if __name__ == '__main__':
 unittest.main()
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /