mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
bpo-36999: Add asyncio.Task.get_coro() (GH-13680)
https://bugs.python.org/issue36999
This commit is contained in:
parent
25ee0c3bf1
commit
98ef92002e
6 changed files with 52 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue