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

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


https://hg.python.org/cpython/rev/a0a699b828e7
changeset:   96440:a0a699b828e7
branch:      3.5
parent:      96438:1dc232783012
user:        Yury Selivanov <yselivanov at sprymix.com>
date:        Sun May 31 21:44:05 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