本文整理匯總了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')
示例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"]
示例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
示例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
示例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)
示例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
示例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"]
示例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"]
示例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}
示例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