Skip to content

Commit d3ce999

Browse files
authored
Merge pull request #10 from maxrjones/improve-test-coverage
Expand test coverage
2 parents 9e90a02 + 6f5f960 commit d3ce999

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

tests/test_store/test_object.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pytest
55

66
obstore = pytest.importorskip("obstore")
7-
from obstore.store import LocalStore
7+
from obstore.store import LocalStore, MemoryStore
88

99
from zarr.core.buffer import Buffer, cpu
1010
from zarr.storage import ObjectStore
@@ -43,8 +43,29 @@ def test_store_repr(self, store: ObjectStore) -> None:
4343
def test_store_supports_writes(self, store: ObjectStore) -> None:
4444
assert store.supports_writes
4545

46-
def test_store_supports_partial_writes(self, store: ObjectStore) -> None:
46+
async def test_store_supports_partial_writes(self, store: ObjectStore) -> None:
4747
assert not store.supports_partial_writes
48+
with pytest.raises(NotImplementedError):
49+
await store.set_partial_values([("foo", 0, b"\x01\x02\x03\x04")])
4850

4951
def test_store_supports_listing(self, store: ObjectStore) -> None:
5052
assert store.supports_listing
53+
54+
def test_store_equal(self, store: ObjectStore) -> None:
55+
"""Test store equality"""
56+
# Test equality against a different instance type
57+
assert store != 0
58+
# Test equality against a different store type
59+
new_memory_store = ObjectStore(MemoryStore())
60+
assert store != new_memory_store
61+
# Test equality against a read only store
62+
new_local_store = ObjectStore(LocalStore(prefix=store.store.prefix), read_only=True)
63+
assert store != new_local_store
64+
# Test two memory stores cannot be equal
65+
second_memory_store = ObjectStore(MemoryStore())
66+
assert new_memory_store != second_memory_store
67+
68+
def test_store_init_raises(self) -> None:
69+
"""Test __init__ raises appropriate error for improper store type"""
70+
with pytest.raises(TypeError):
71+
ObjectStore("path/to/store")

0 commit comments

Comments
 (0)