|
4 | 4 | import pytest |
5 | 5 |
|
6 | 6 | obstore = pytest.importorskip("obstore") |
7 | | -from obstore.store import LocalStore |
| 7 | +from obstore.store import LocalStore, MemoryStore |
8 | 8 |
|
9 | 9 | from zarr.core.buffer import Buffer, cpu |
10 | 10 | from zarr.storage import ObjectStore |
@@ -43,8 +43,29 @@ def test_store_repr(self, store: ObjectStore) -> None: |
43 | 43 | def test_store_supports_writes(self, store: ObjectStore) -> None: |
44 | 44 | assert store.supports_writes |
45 | 45 |
|
46 | | - def test_store_supports_partial_writes(self, store: ObjectStore) -> None: |
| 46 | + async def test_store_supports_partial_writes(self, store: ObjectStore) -> None: |
47 | 47 | assert not store.supports_partial_writes |
| 48 | + with pytest.raises(NotImplementedError): |
| 49 | + await store.set_partial_values([("foo", 0, b"\x01\x02\x03\x04")]) |
48 | 50 |
|
49 | 51 | def test_store_supports_listing(self, store: ObjectStore) -> None: |
50 | 52 | 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