[Python-checkins] bpo-32415: Add more tests (#4995)

Yury Selivanov webhook-mailer at python.org
Sat Dec 23 15:42:30 EST 2017


https://github.com/python/cpython/commit/a8fb07978953d3f55cfce836e3669d8b8e82b4c1
commit: a8fb07978953d3f55cfce836e3669d8b8e82b4c1
branch: master
author: Yury Selivanov <yury at magic.io>
committer: GitHub <noreply at github.com>
date: 2017-12-23T15:42:27-05:00
summary:

bpo-32415: Add more tests (#4995)

files:
M Lib/test/test_asyncio/test_tasks.py

diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py
index 84669cd6c7e..7bb43058c80 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})



More information about the Python-checkins mailing list