Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e42cc38

Browse files
committed
Issue 24017: Add a test for CoroWrapper and 'async def' coroutines
1 parent 6a0fab9 commit e42cc38

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

Lib/test/test_asyncio/test_pep492.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,20 @@ def func():
119119
self.assertEqual(coro.send(None), 'spam')
120120
coro.close()
121121

122+
def test_async_ded_coroutines(self):
123+
async def bar():
124+
return 'spam'
125+
async def foo():
126+
return await bar()
127+
128+
# production mode
129+
data = self.loop.run_until_complete(foo())
130+
self.assertEqual(data, 'spam')
131+
132+
# debug mode
133+
self.loop.set_debug(True)
134+
data = self.loop.run_until_complete(foo())
135+
self.assertEqual(data, 'spam')
122136

123137
if __name__ == '__main__':
124138
unittest.main()

0 commit comments

Comments
 (0)