當前位置: 首頁>>代碼示例>>Python>>正文


Python Event.dump方法代碼示例

本文整理匯總了Python中wishbone.event.Event.dump方法的典型用法代碼示例。如果您正苦於以下問題:Python Event.dump方法的具體用法?Python Event.dump怎麽用?Python Event.dump使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在wishbone.event.Event的用法示例。


在下文中一共展示了Event.dump方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_event_slurp

# 需要導入模塊: from wishbone.event import Event [as 別名]
# 或者: from wishbone.event.Event import dump [as 別名]
def test_event_slurp():

    a = Event()
    b = Event()
    b.slurp(a.dump())

    assert a.get('uuid') == b.get('uuid')
開發者ID:smetj,項目名稱:wishbone,代碼行數:9,代碼來源:test_event.py

示例2: test_event_appendBulk

# 需要導入模塊: from wishbone.event import Event [as 別名]
# 或者: from wishbone.event.Event import dump [as 別名]
def test_event_appendBulk():

    e = Event(bulk=True)
    ee = Event({"one": 1})

    e.appendBulk(ee)
    assert e.dump()["data"][0]["uuid"] == ee.data["uuid"]
開發者ID:smetj,項目名稱:wishbone,代碼行數:9,代碼來源:test_event.py

示例3: test_event_slurp_bad

# 需要導入模塊: from wishbone.event import Event [as 別名]
# 或者: from wishbone.event.Event import dump [as 別名]
def test_event_slurp_bad():

    a = Event()
    del(a.data["uuid"])
    b = Event()

    try:
        b.slurp(a.dump())
    except InvalidData:
        assert True
    else:
        assert False
開發者ID:smetj,項目名稱:wishbone,代碼行數:14,代碼來源:test_event.py

示例4: test_event_decrementTTL

# 需要導入模塊: from wishbone.event import Event [as 別名]
# 或者: from wishbone.event.Event import dump [as 別名]
def test_event_decrementTTL():

    a = Event(ttl=2)
    a.decrementTTL()
    assert a.dump()["ttl"] == 1

    try:
        a.decrementTTL()
    except TTLExpired:
        assert True
    else:
        assert False
開發者ID:smetj,項目名稱:wishbone,代碼行數:14,代碼來源:test_event.py

示例5: test_event_dump

# 需要導入模塊: from wishbone.event import Event [as 別名]
# 或者: from wishbone.event.Event import dump [as 別名]
def test_event_dump():

    from wishbone.event import EVENT_RESERVED

    data = {"one": 1, "two": 2}
    a = Event(data)
    result = a.dump()

    for key in EVENT_RESERVED:
        assert key in result

    assert result["data"] == data
    assert isinstance(result["timestamp"], float)
開發者ID:smetj,項目名稱:wishbone,代碼行數:15,代碼來源:test_event.py

示例6: test_event_copy

# 需要導入模塊: from wishbone.event import Event [as 別名]
# 或者: from wishbone.event.Event import dump [as 別名]
def test_event_copy():

    a = Event({"one": 1, "two": 2})
    a.copy("data.one", "data.two")
    assert a.dump()["data"]["two"] == 1
開發者ID:smetj,項目名稱:wishbone,代碼行數:7,代碼來源:test_event.py

示例7: test_event_bulk_default

# 需要導入模塊: from wishbone.event import Event [as 別名]
# 或者: from wishbone.event.Event import dump [as 別名]
def test_event_bulk_default():

    e = Event(bulk=True)
    assert e.dump()["bulk"]
開發者ID:smetj,項目名稱:wishbone,代碼行數:6,代碼來源:test_event.py

示例8: test_merge_list

# 需要導入模塊: from wishbone.event import Event [as 別名]
# 或者: from wishbone.event.Event import dump [as 別名]
def test_merge_list():

    e = Event(["one"])
    e.merge(["two"])

    assert e.dump()["data"] == ["one", "two"]
開發者ID:smetj,項目名稱:wishbone,代碼行數:8,代碼來源:test_event.py

示例9: test_merge_dict

# 需要導入模塊: from wishbone.event import Event [as 別名]
# 或者: from wishbone.event.Event import dump [as 別名]
def test_merge_dict():

    e = Event({"one": 1})
    e.merge({"two": 2})

    assert e.dump()["data"] == {"one": 1, "two": 2}
開發者ID:smetj,項目名稱:wishbone,代碼行數:8,代碼來源:test_event.py

示例10: test_event_set

# 需要導入模塊: from wishbone.event import Event [as 別名]
# 或者: from wishbone.event.Event import dump [as 別名]
def test_event_set():

    e = Event({"one": 1, "two": {"three": 3}})
    e.set({"four": 4}, "data.two.three")
    assert e.dump()["data"]["two"]["three"]["four"] == 4
開發者ID:smetj,項目名稱:wishbone,代碼行數:7,代碼來源:test_event.py


注:本文中的wishbone.event.Event.dump方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。