Skip to content

Commit ffde28d

Browse files
committed
Adapt ObjectStore tests for new generic class
1 parent d8d3084 commit ffde28d

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

tests/test_store/test_object.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ class StoreKwargs(TypedDict):
2222
read_only: bool
2323

2424

25-
class TestObjectStore(StoreTests[ObjectStore, cpu.Buffer]):
26-
store_cls = ObjectStore
25+
class TestObjectStore(StoreTests[ObjectStore[LocalStore], cpu.Buffer]):
26+
store_cls = ObjectStore[LocalStore]
2727
buffer_cls = cpu.Buffer
2828

2929
@pytest.fixture
@@ -32,35 +32,35 @@ def store_kwargs(self, tmp_path: Path) -> StoreKwargs:
3232
return {"store": store, "read_only": False}
3333

3434
@pytest.fixture
35-
def store(self, store_kwargs: StoreKwargs) -> ObjectStore:
35+
def store(self, store_kwargs: StoreKwargs) -> ObjectStore[LocalStore]:
3636
return self.store_cls(**store_kwargs)
3737

38-
async def get(self, store: ObjectStore, key: str) -> Buffer:
38+
async def get(self, store: ObjectStore[LocalStore], key: str) -> Buffer:
3939
assert isinstance(store.store, LocalStore)
4040
new_local_store = LocalStore(prefix=store.store.prefix)
4141
return self.buffer_cls.from_bytes(obstore.get(new_local_store, key).bytes())
4242

43-
async def set(self, store: ObjectStore, key: str, value: Buffer) -> None:
43+
async def set(self, store: ObjectStore[LocalStore], key: str, value: Buffer) -> None:
4444
assert isinstance(store.store, LocalStore)
4545
new_local_store = LocalStore(prefix=store.store.prefix)
4646
obstore.put(new_local_store, key, value.to_bytes())
4747

48-
def test_store_repr(self, store: ObjectStore) -> None:
48+
def test_store_repr(self, store: ObjectStore[LocalStore]) -> None:
4949
from fnmatch import fnmatch
5050

5151
pattern = "ObjectStore(object_store://LocalStore(*))"
5252
assert fnmatch(f"{store!r}", pattern)
5353

54-
def test_store_supports_writes(self, store: ObjectStore) -> None:
54+
def test_store_supports_writes(self, store: ObjectStore[LocalStore]) -> None:
5555
assert store.supports_writes
5656

57-
def test_store_supports_partial_writes(self, store: ObjectStore) -> None:
57+
def test_store_supports_partial_writes(self, store: ObjectStore[LocalStore]) -> None:
5858
assert not store.supports_partial_writes
5959

60-
def test_store_supports_listing(self, store: ObjectStore) -> None:
60+
def test_store_supports_listing(self, store: ObjectStore[LocalStore]) -> None:
6161
assert store.supports_listing
6262

63-
def test_store_equal(self, store: ObjectStore) -> None:
63+
def test_store_equal(self, store: ObjectStore[LocalStore]) -> None:
6464
"""Test store equality"""
6565
# Test equality against a different instance type
6666
assert store != 0
@@ -78,15 +78,15 @@ def test_store_equal(self, store: ObjectStore) -> None:
7878
def test_store_init_raises(self) -> None:
7979
"""Test __init__ raises appropriate error for improper store type"""
8080
with pytest.raises(TypeError):
81-
ObjectStore("path/to/store") # type: ignore[arg-type]
81+
ObjectStore("path/to/store") # type: ignore[type-var]
8282

83-
async def test_store_getsize(self, store: ObjectStore) -> None:
83+
async def test_store_getsize(self, store: ObjectStore[LocalStore]) -> None:
8484
buf = cpu.Buffer.from_bytes(b"\x01\x02\x03\x04")
8585
await self.set(store, "key", buf)
8686
size = await store.getsize("key")
8787
assert size == len(buf)
8888

89-
async def test_store_getsize_prefix(self, store: ObjectStore) -> None:
89+
async def test_store_getsize_prefix(self, store: ObjectStore[LocalStore]) -> None:
9090
buf = cpu.Buffer.from_bytes(b"\x01\x02\x03\x04")
9191
await self.set(store, "c/key1/0", buf)
9292
await self.set(store, "c/key2/0", buf)

0 commit comments

Comments
 (0)