summaryrefslogtreecommitdiff
path: root/Lib/test/test_asyncio/test_events.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_asyncio/test_events.py')
-rw-r--r--Lib/test/test_asyncio/test_events.py33
1 files changed, 17 insertions, 16 deletions
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
index aefa33ba25..e5e41fc1a8 100644
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -66,6 +66,20 @@ def _test_get_event_loop_new_process__sub_proc():
return loop.run_until_complete(doit())
+class CoroLike:
+ def send(self, v):
+ pass
+
+ def throw(self, *exc):
+ pass
+
+ def close(self):
+ pass
+
+ def __await__(self):
+ pass
+
+
ONLYCERT = data_file('ssl_cert.pem')
ONLYKEY = data_file('ssl_key.pem')
SIGNED_CERTFILE = data_file('keycert3.pem')
@@ -2365,20 +2379,7 @@ class HandleTests(test_utils.TestCase):
# collections.abc.Coroutine, but lack cr_core or gi_code attributes
# (such as ones compiled with Cython).
- class Coro:
- def send(self, v):
- pass
-
- def throw(self, *exc):
- pass
-
- def close(self):
- pass
-
- def __await__(self):
- pass
-
- coro = Coro()
+ coro = CoroLike()
coro.__name__ = 'AAA'
self.assertTrue(asyncio.iscoroutine(coro))
self.assertEqual(coroutines._format_coroutine(coro), 'AAA()')
@@ -2389,10 +2390,10 @@ class HandleTests(test_utils.TestCase):
coro.cr_running = True
self.assertEqual(coroutines._format_coroutine(coro), 'BBB() running')
- coro = Coro()
+ coro = CoroLike()
# Some coroutines might not have '__name__', such as
# built-in async_gen.asend().
- self.assertEqual(coroutines._format_coroutine(coro), 'Coro()')
+ self.assertEqual(coroutines._format_coroutine(coro), 'CoroLike()')
class TimerTests(unittest.TestCase):