本文整理匯總了Python中selectors.BaseSelector方法的典型用法代碼示例。如果您正苦於以下問題:Python selectors.BaseSelector方法的具體用法?Python selectors.BaseSelector怎麽用?Python selectors.BaseSelector使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類selectors
的用法示例。
在下文中一共展示了selectors.BaseSelector方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: selector_subtest
# 需要導入模塊: import selectors [as 別名]
# 或者: from selectors import BaseSelector [as 別名]
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
示例2: __init__
# 需要導入模塊: import selectors [as 別名]
# 或者: from selectors import BaseSelector [as 別名]
def __init__(
self, selector: BaseSelector, inputhook: Callable[["InputHookContext"], None]
) -> None:
self.selector = selector
self.inputhook = inputhook
self._r, self._w = os.pipe()