本文整理汇总了Python中vdirsyncer.storage.memory.MemoryStorage.get_multi方法的典型用法代码示例。如果您正苦于以下问题:Python MemoryStorage.get_multi方法的具体用法?Python MemoryStorage.get_multi怎么用?Python MemoryStorage.get_multi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vdirsyncer.storage.memory.MemoryStorage
的用法示例。
在下文中一共展示了MemoryStorage.get_multi方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_moved_href
# 需要导入模块: from vdirsyncer.storage.memory import MemoryStorage [as 别名]
# 或者: from vdirsyncer.storage.memory.MemoryStorage import get_multi [as 别名]
def test_moved_href():
'''
Concrete application: ppl_ stores contact aliases in filenames, which means
item's hrefs get changed. Vdirsyncer doesn't synchronize this data, but
also shouldn't do things like deleting and re-uploading to the server.
.. _ppl: http://ppladdressbook.org/
'''
a = MemoryStorage()
b = MemoryStorage()
status = {}
href, etag = a.upload(Item(u'UID:haha'))
sync(a, b, status)
b.items['lol'] = b.items.pop('haha')
# The sync algorithm should prefetch `lol`, see that it's the same ident
# and not do anything else.
a.get_multi = blow_up # Absolutely no prefetch on A
# No actual sync actions
a.delete = a.update = a.upload = b.delete = b.update = b.upload = blow_up
sync(a, b, status)
assert len(status) == 1
assert items(a) == items(b) == {'UID:haha'}
assert status['haha'][1]['href'] == 'lol'
old_status = deepcopy(status)
# Further sync should be a noop. Not even prefetching should occur.
b.get_multi = blow_up
sync(a, b, status)
assert old_status == status
assert items(a) == items(b) == {'UID:haha'}