diff options
author | Charles-François Natali <cf.natali@gmail.com> | 2013-12-01 10:04:17 (GMT) |
---|---|---|
committer | Charles-François Natali <cf.natali@gmail.com> | 2013-12-01 10:04:17 (GMT) |
commit | b3330a0abf3edb233fc28a392776cc41efa25853 (patch) | |
tree | 98affe40e0e41250cda96021051669054c9489a4 /Lib/asyncio | |
parent | be0708f06634ae4426ca9032314be4b8902d6008 (diff) | |
download | cpython-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.py | 14 |
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. |