Commit ad583a8e authored by Yury Selivanov's avatar Yury Selivanov

Issue 24004: Add a unittest for @asyncio.coroutine supporting Awaitables

parent 353f2299
......@@ -106,6 +106,19 @@ class CoroutineTests(BaseTest):
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()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment