本文整理汇总了Python中vdirsyncer.storage.memory.MemoryStorage.items方法的典型用法代码示例。如果您正苦于以下问题:Python MemoryStorage.items方法的具体用法?Python MemoryStorage.items怎么用?Python MemoryStorage.items使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vdirsyncer.storage.memory.MemoryStorage
的用法示例。
在下文中一共展示了MemoryStorage.items方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_repair_uids
# 需要导入模块: from vdirsyncer.storage.memory import MemoryStorage [as 别名]
# 或者: from vdirsyncer.storage.memory.MemoryStorage import items [as 别名]
def test_repair_uids():
s = MemoryStorage()
s.items = {
'one': ('asdf', Item(u'BEGIN:VCARD\nFN:Hans\nUID:asdf\nEND:VCARD')),
'two': ('asdf', Item(u'BEGIN:VCARD\nFN:Peppi\nUID:asdf\nEND:VCARD'))
}
uid1, uid2 = [s.get(href)[0].uid for href, etag in s.list()]
assert uid1 == uid2
repair_storage(s)
uid1, uid2 = [s.get(href)[0].uid for href, etag in s.list()]
assert uid1 != uid2
示例2: test_repair_uids
# 需要导入模块: from vdirsyncer.storage.memory import MemoryStorage [as 别名]
# 或者: from vdirsyncer.storage.memory.MemoryStorage import items [as 别名]
def test_repair_uids(uid):
s = MemoryStorage()
s.items = {
'one': (
'asdf',
Item(u'BEGIN:VCARD\nFN:Hans\nUID:{}\nEND:VCARD'.format(uid))
),
'two': (
'asdf',
Item(u'BEGIN:VCARD\nFN:Peppi\nUID:{}\nEND:VCARD'.format(uid))
)
}
uid1, uid2 = [s.get(href)[0].uid for href, etag in s.list()]
assert uid1 == uid2
repair_storage(s, repair_unsafe_uid=False)
uid1, uid2 = [s.get(href)[0].uid for href, etag in s.list()]
assert uid1 != uid2