diff options
author | Yury Selivanov <yury@magic.io> | 2017-12-23 20:42:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-23 20:42:27 (GMT) |
commit | a8fb07978953d3f55cfce836e3669d8b8e82b4c1 (patch) | |
tree | 9adcf1b5fa2bb6423b880722eac9c8b671df257e /Lib/test/test_asyncio | |
parent | 0f47fa2c89a6b9a04969219dfb0c3801c611e3ca (diff) | |
download | cpython-a8fb07978953d3f55cfce836e3669d8b8e82b4c1.zip cpython-a8fb07978953d3f55cfce836e3669d8b8e82b4c1.tar.gz cpython-a8fb07978953d3f55cfce836e3669d8b8e82b4c1.tar.bz2 |
bpo-32415: Add more tests (#4995)
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r-- | Lib/test/test_asyncio/test_tasks.py | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py index 84669cd..7bb4305 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -2308,10 +2308,28 @@ class BaseTaskIntrospectionTests: _enter_task = None _leave_task = None - def test__register_task(self): - task = mock.Mock() + def test__register_task_1(self): + class TaskLike: + @property + def _loop(self): + return loop + + task = TaskLike() loop = mock.Mock() - task.get_loop = lambda: loop + + self.assertEqual(asyncio.all_tasks(loop), set()) + self._register_task(task) + self.assertEqual(asyncio.all_tasks(loop), {task}) + self._unregister_task(task) + + def test__register_task_2(self): + class TaskLike: + def get_loop(self): + return loop + + task = TaskLike() + loop = mock.Mock() + self.assertEqual(asyncio.all_tasks(loop), set()) self._register_task(task) self.assertEqual(asyncio.all_tasks(loop), {task}) |