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


Python MemoryStorage.get_multi方法代码示例

本文整理汇总了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'}
开发者ID:,项目名称:,代码行数:36,代码来源:


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