本文整理汇总了Python中vdirsyncer.storage.memory.MemoryStorage.delete方法的典型用法代码示例。如果您正苦于以下问题:Python MemoryStorage.delete方法的具体用法?Python MemoryStorage.delete怎么用?Python MemoryStorage.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vdirsyncer.storage.memory.MemoryStorage
的用法示例。
在下文中一共展示了MemoryStorage.delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_updated_and_deleted
# 需要导入模块: from vdirsyncer.storage.memory import MemoryStorage [as 别名]
# 或者: from vdirsyncer.storage.memory.MemoryStorage import delete [as 别名]
def test_updated_and_deleted():
a = MemoryStorage()
b = MemoryStorage()
href_a, etag_a = a.upload(Item(u"UID:1"))
status = {}
sync(a, b, status, force_delete=True)
(href_b, etag_b), = b.list()
b.delete(href_b, etag_b)
a.update(href_a, Item(u"UID:1\nupdated"), etag_a)
sync(a, b, status, force_delete=True)
assert len(list(a.list())) == len(list(b.list())) == 1
示例2: test_updated_and_deleted
# 需要导入模块: from vdirsyncer.storage.memory import MemoryStorage [as 别名]
# 或者: from vdirsyncer.storage.memory.MemoryStorage import delete [as 别名]
def test_updated_and_deleted():
a = MemoryStorage()
b = MemoryStorage()
href_a, etag_a = a.upload(Item(u'UID:1'))
status = {}
sync(a, b, status, force_delete=True)
(href_b, etag_b), = b.list()
b.delete(href_b, etag_b)
updated = Item(u'UID:1\nupdated')
a.update(href_a, updated, etag_a)
sync(a, b, status, force_delete=True)
assert items(a) == items(b) == {updated.raw}
示例3: test_deletion
# 需要导入模块: from vdirsyncer.storage.memory import MemoryStorage [as 别名]
# 或者: from vdirsyncer.storage.memory.MemoryStorage import delete [as 别名]
def test_deletion():
a = MemoryStorage()
b = MemoryStorage()
status = {}
item = Item(u'UID:1')
a.upload(item)
a.upload(Item(u'UID:2'))
sync(a, b, status)
b.delete('1.txt', b.get('1.txt')[1])
sync(a, b, status)
assert not a.has('1.txt') and not b.has('1.txt')
a.upload(item)
sync(a, b, status)
assert a.has('1.txt') and b.has('1.txt')
a.delete('1.txt', a.get('1.txt')[1])
sync(a, b, status)
assert not a.has('1.txt') and not b.has('1.txt')
示例4: test_deletion
# 需要导入模块: from vdirsyncer.storage.memory import MemoryStorage [as 别名]
# 或者: from vdirsyncer.storage.memory.MemoryStorage import delete [as 别名]
def test_deletion():
a = MemoryStorage(fileext=".a")
b = MemoryStorage(fileext=".b")
status = {}
item = Item(u"UID:1")
a.upload(item)
a.upload(Item(u"UID:2"))
sync(a, b, status)
b.delete("1.b", b.get("1.b")[1])
sync(a, b, status)
assert not a.has("1.a") and not b.has("1.b")
a.upload(item)
sync(a, b, status)
assert a.has("1.a") and b.has("1.b")
a.delete("1.a", a.get("1.a")[1])
sync(a, b, status)
assert not a.has("1.a") and not b.has("1.b")
示例5: test_deletion
# 需要导入模块: from vdirsyncer.storage.memory import MemoryStorage [as 别名]
# 或者: from vdirsyncer.storage.memory.MemoryStorage import delete [as 别名]
def test_deletion():
a = MemoryStorage(fileext='.a')
b = MemoryStorage(fileext='.b')
status = {}
item = Item(u'UID:1')
a.upload(item)
item2 = Item(u'UID:2')
a.upload(item2)
sync(a, b, status)
b.delete('1.b', b.get('1.b')[1])
sync(a, b, status)
assert items(a) == items(b) == {item2.raw}
a.upload(item)
sync(a, b, status)
assert items(a) == items(b) == {item.raw, item2.raw}
a.delete('1.a', a.get('1.a')[1])
sync(a, b, status)
assert items(a) == items(b) == {item2.raw}