summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
diff options
context:
space:
mode:
authorCharles-François Natali <cf.natali@gmail.com>2013-12-01 10:04:17 (GMT)
committerCharles-François Natali <cf.natali@gmail.com>2013-12-01 10:04:17 (GMT)
commitb3330a0abf3edb233fc28a392776cc41efa25853 (patch)
tree98affe40e0e41250cda96021051669054c9489a4 /Lib/asyncio
parentbe0708f06634ae4426ca9032314be4b8902d6008 (diff)
downloadcpython-b3330a0abf3edb233fc28a392776cc41efa25853.zip
cpython-b3330a0abf3edb233fc28a392776cc41efa25853.tar.gz
cpython-b3330a0abf3edb233fc28a392776cc41efa25853.tar.bz2
Issue #19842: Refactor BaseSelector to make it an actual usable ABC.
Diffstat (limited to 'Lib/asyncio')
-rw-r--r--Lib/asyncio/test_utils.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/asyncio/test_utils.py b/Lib/asyncio/test_utils.py
index c278dd1..d7d8442 100644
--- a/Lib/asyncio/test_utils.py
+++ b/Lib/asyncio/test_utils.py
@@ -142,9 +142,23 @@ def make_test_protocol(base):
class TestSelector(selectors.BaseSelector):
+ def __init__(self):
+ self.keys = {}
+
+ def register(self, fileobj, events, data=None):
+ key = selectors.SelectorKey(fileobj, 0, events, data)
+ self.keys[fileobj] = key
+ return key
+
+ def unregister(self, fileobj):
+ return self.keys.pop(fileobj)
+
def select(self, timeout):
return []
+ def get_map(self):
+ return self.keys
+
class TestLoop(base_events.BaseEventLoop):
"""Loop for unittests.