Skip to content

Commit 9835ef9

Browse files
committed
tests: storage: add testcase for batch.delete
1 parent a284554 commit 9835ef9

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

tests/server/test_storage.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,19 @@ class FakeError(Exception): pass
5656
assert db.get(b"a") == b"1"
5757

5858

59+
def test_batch_delete(db):
60+
db.put(b"a1", b"")
61+
db.put(b"a2", b"")
62+
db.put(b"a4", b"")
63+
db.put(b"a5", b"")
64+
assert list(db.iterator()) == [(b"a1", b""), (b"a2", b""), (b"a4", b""), (b"a5", b"")]
65+
with db.write_batch() as b:
66+
b.delete(b"a2")
67+
b.delete(b"a3")
68+
b.delete(b"a4")
69+
assert list(db.iterator()) == [(b"a1", b""), (b"a5", b"")]
70+
71+
5972
def test_iterator(db):
6073
"""
6174
The iterator should contain all key/value pairs starting with prefix

0 commit comments

Comments
 (0)