Python selectors.BaseSelector() Examples

The following are 2 code examples of selectors.BaseSelector(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module selectors , or try the search function .
Example #1
Source File: test_selector.py    From asynctest with Apache License 2.0 5 votes vote down vote up
def selector_subtest(method):
    @functools.wraps(method)
    def wrapper(self):
        with self.subTest(test='without_selector'):
            method(self, asynctest.selector.TestSelector(), None)

        with self.subTest(test='with_selector'):
            mock = unittest.mock.Mock(selectors.BaseSelector)
            mock.get_map.return_value = mock._fd_to_key = {}
            method(self, asynctest.selector.TestSelector(mock), mock)

    return wrapper 
Example #2
Source File: inputhook.py    From python-prompt-toolkit with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(
        self, selector: BaseSelector, inputhook: Callable[["InputHookContext"], None]
    ) -> None:
        self.selector = selector
        self.inputhook = inputhook
        self._r, self._w = os.pipe()