本文整理汇总了Python中aioxmpp.callbacks.AdHocSignal.disconnect方法的典型用法代码示例。如果您正苦于以下问题:Python AdHocSignal.disconnect方法的具体用法?Python AdHocSignal.disconnect怎么用?Python AdHocSignal.disconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aioxmpp.callbacks.AdHocSignal
的用法示例。
在下文中一共展示了AdHocSignal.disconnect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_disconnect_is_idempotent
# 需要导入模块: from aioxmpp.callbacks import AdHocSignal [as 别名]
# 或者: from aioxmpp.callbacks.AdHocSignal import disconnect [as 别名]
def test_disconnect_is_idempotent(self):
signal = AdHocSignal()
fun = unittest.mock.MagicMock()
fun.return_value = None
token = signal.connect(fun)
signal.disconnect(token)
signal.disconnect(token)
示例2: test_context_connect
# 需要导入模块: from aioxmpp.callbacks import AdHocSignal [as 别名]
# 或者: from aioxmpp.callbacks.AdHocSignal import disconnect [as 别名]
def test_context_connect(self):
signal = AdHocSignal()
fun = unittest.mock.MagicMock()
fun.return_value = None
with signal.context_connect(fun):
signal("foo")
signal("bar")
with signal.context_connect(fun) as token:
signal("baz")
signal.disconnect(token)
signal("fnord")
self.assertSequenceEqual(
[
unittest.mock.call("foo"),
unittest.mock.call("baz"),
],
fun.mock_calls
)
示例3: test_remove_by_token
# 需要导入模块: from aioxmpp.callbacks import AdHocSignal [as 别名]
# 或者: from aioxmpp.callbacks.AdHocSignal import disconnect [as 别名]
def test_remove_by_token(self):
signal = AdHocSignal()
fun = unittest.mock.MagicMock()
fun.return_value = None
token = signal.connect(fun)
signal()
self.assertSequenceEqual(
[
unittest.mock.call(),
],
fun.mock_calls
)
signal()
self.assertSequenceEqual(
[
unittest.mock.call(),
unittest.mock.call(),
],
fun.mock_calls
)
signal.disconnect(token)
signal()
self.assertSequenceEqual(
[
unittest.mock.call(),
unittest.mock.call(),
],
fun.mock_calls
)