From b3330a0abf3edb233fc28a392776cc41efa25853 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Fran=C3=A7ois=20Natali?= Date: Sun, 1 Dec 2013 11:04:17 +0100 Subject: Issue #19842: Refactor BaseSelector to make it an actual usable ABC. --- Lib/asyncio/test_utils.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Lib/asyncio/test_utils.py') diff --git a/Lib/asyncio/test_utils.py b/Lib/asyncio/test_utils.py index c278dd1773..d7d844249c 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. -- cgit v1.2.1