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

This commit is contained in:
Yury Selivanov 2015-05-30 21:04:37 -04:00
parent 353f2299bf
commit ad583a8e6d
1 changed files with 13 additions and 0 deletions

View File

@ -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()