bpo-36999: Add asyncio.Task.get_coro() (GH-13680)

https://bugs.python.org/issue36999
This commit is contained in:
Alex Grönholm 2019-05-30 18:30:09 +03:00 committed by Miss Islington (bot)
parent 25ee0c3bf1
commit 98ef92002e
6 changed files with 52 additions and 1 deletions

View file

@ -2425,6 +2425,16 @@ class BaseTaskTests:
self.assertEqual(cvar.get(), -1)
def test_get_coro(self):
loop = asyncio.new_event_loop()
coro = coroutine_function()
try:
task = self.new_task(loop, coro)
loop.run_until_complete(task)
self.assertIs(task.get_coro(), coro)
finally:
loop.close()
def add_subclass_tests(cls):
BaseTask = cls.Task