当前位置: 首页>>代码示例>>Python>>正文


Python Emitter.events方法代码示例

本文整理汇总了Python中emitter.Emitter.events方法的典型用法代码示例。如果您正苦于以下问题:Python Emitter.events方法的具体用法?Python Emitter.events怎么用?Python Emitter.events使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在emitter.Emitter的用法示例。


在下文中一共展示了Emitter.events方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_events__5

# 需要导入模块: from emitter import Emitter [as 别名]
# 或者: from emitter.Emitter import events [as 别名]
def test_events__5():
    """
    Should not return the original object, but a copy.
    """
    emitter = Emitter()
    emitter.on("event", callable)
    assert emitter.events() is not emitter.events()
开发者ID:titouandk,项目名称:emitter.py,代码行数:9,代码来源:test-emitter.py

示例2: test_off__13

# 需要导入模块: from emitter import Emitter [as 别名]
# 或者: from emitter.Emitter import events [as 别名]
def test_off__13():
    """
    Delete the event if no more listeners.
    """
    emitter = Emitter()
    emitter.on("event", callable)
    assert "event" in emitter.events()

    emitter.off("event", callable)
    assert emitter.events() == set()
开发者ID:titouandk,项目名称:emitter.py,代码行数:12,代码来源:test-emitter.py

示例3: test_off__5

# 需要导入模块: from emitter import Emitter [as 别名]
# 或者: from emitter.Emitter import events [as 别名]
def test_off__5():
    """
    True event can be removed.
    """
    emitter = Emitter()
    emitter.on(True, callable)
    assert True in emitter.events()

    emitter.off(True)
    assert True not in emitter.events()
开发者ID:titouandk,项目名称:emitter.py,代码行数:12,代码来源:test-emitter.py

示例4: test_off__4

# 需要导入模块: from emitter import Emitter [as 别名]
# 或者: from emitter.Emitter import events [as 别名]
def test_off__4():
    """
    False event can be removed.
    """
    emitter = Emitter()
    emitter.on(False, callable)
    assert False in emitter.events()

    emitter.off(False)
    assert False not in emitter.events()
开发者ID:titouandk,项目名称:emitter.py,代码行数:12,代码来源:test-emitter.py

示例5: test_events__3

# 需要导入模块: from emitter import Emitter [as 别名]
# 或者: from emitter.Emitter import events [as 别名]
def test_events__3():
    """
    False event can be retrieved.
    """
    emitter = Emitter()
    emitter.on(False, callable)
    assert False in emitter.events()
开发者ID:titouandk,项目名称:emitter.py,代码行数:9,代码来源:test-emitter.py

示例6: test_events__4

# 需要导入模块: from emitter import Emitter [as 别名]
# 或者: from emitter.Emitter import events [as 别名]
def test_events__4():
    """
    True event can be retrieved.
    """
    emitter = Emitter()
    emitter.on(True, callable)
    assert True in emitter.events()
开发者ID:titouandk,项目名称:emitter.py,代码行数:9,代码来源:test-emitter.py

示例7: test_on__4

# 需要导入模块: from emitter import Emitter [as 别名]
# 或者: from emitter.Emitter import events [as 别名]
def test_on__4():
    """
    A string is a valid event.
    """
    emitter = Emitter()
    emitter.on("event", callable)

    assert "event" in emitter.events()
开发者ID:titouandk,项目名称:emitter.py,代码行数:10,代码来源:test-emitter.py

示例8: test_on__3

# 需要导入模块: from emitter import Emitter [as 别名]
# 或者: from emitter.Emitter import events [as 别名]
def test_on__3():
    """
    False is a valid event.
    """
    emitter = Emitter()
    emitter.on(False, callable)

    assert False in emitter.events()
开发者ID:titouandk,项目名称:emitter.py,代码行数:10,代码来源:test-emitter.py

示例9: test_on__2

# 需要导入模块: from emitter import Emitter [as 别名]
# 或者: from emitter.Emitter import events [as 别名]
def test_on__2():
    """
    True is a valid event.
    """
    emitter = Emitter()
    emitter.on(True, callable)

    assert True in emitter.events()
开发者ID:titouandk,项目名称:emitter.py,代码行数:10,代码来源:test-emitter.py

示例10: test_off__1

# 需要导入模块: from emitter import Emitter [as 别名]
# 或者: from emitter.Emitter import events [as 别名]
def test_off__1():
    """
    Called with no arguments, it removes all the events.
    """
    emitter = Emitter()
    emitter.on("raccoon", callable)
    emitter.on("fox", callable)
    emitter.off()
    assert emitter.events() == set()
开发者ID:titouandk,项目名称:emitter.py,代码行数:11,代码来源:test-emitter.py

示例11: test_once__3

# 需要导入模块: from emitter import Emitter [as 别名]
# 或者: from emitter.Emitter import events [as 别名]
def test_once__3():
    """
    Event should be cleaned if no more listeners.
    """
    emitter = Emitter()
    emitter.once("event", callable)
    emitter.emit("event")

    assert emitter.events() == set()
开发者ID:titouandk,项目名称:emitter.py,代码行数:11,代码来源:test-emitter.py

示例12: test_events__2

# 需要导入模块: from emitter import Emitter [as 别名]
# 或者: from emitter.Emitter import events [as 别名]
def test_events__2():
    """
    Returns a set containing all the registered events.
    """
    emitter = Emitter()
    emitter.on("event1", callable)
    emitter.on("event2", callable)
    emitter.on("event3", callable)
    events = emitter.events()
    assert events == {"event1", "event2", "event3"}
开发者ID:titouandk,项目名称:emitter.py,代码行数:12,代码来源:test-emitter.py

示例13: test_on__6

# 需要导入模块: from emitter import Emitter [as 别名]
# 或者: from emitter.Emitter import events [as 别名]
def test_on__6():
    """
    Multiple events can be registered.
    """
    emitter = Emitter()

    emitter.on("event1", callable)
    emitter.on("event2", callable)

    assert "event1" in emitter.events()
    assert "event2" in emitter.events()
开发者ID:titouandk,项目名称:emitter.py,代码行数:13,代码来源:test-emitter.py

示例14: test_events__1

# 需要导入模块: from emitter import Emitter [as 别名]
# 或者: from emitter.Emitter import events [as 别名]
def test_events__1():
    """
    Returns a empty set if no events registered.
    """
    emitter = Emitter()
    assert emitter.events() == set()
开发者ID:titouandk,项目名称:emitter.py,代码行数:8,代码来源:test-emitter.py


注:本文中的emitter.Emitter.events方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。