Skip to content

Commit e1caef0

Browse files
committed
Update reprs for LoggingStore and WrapperStore
1 parent bf58808 commit e1caef0

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

src/zarr/storage/_logging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def __str__(self) -> str:
161161
return f"logging-{self._store}"
162162

163163
def __repr__(self) -> str:
164-
return f"LoggingStore({repr(self._store)!r})"
164+
return f"LoggingStore({self._store.__class__.__name__}, '{self._store}')"
165165

166166
def __eq__(self, other: object) -> bool:
167167
with self.log(other):

src/zarr/storage/_wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def __str__(self) -> str:
8181
return f"wrapping-{self._store}"
8282

8383
def __repr__(self) -> str:
84-
return f"WrapperStore({repr(self._store)!r})"
84+
return f"WrapperStore({self._store.__class__.__name__}, '{self._store}')"
8585

8686
async def get(
8787
self, key: str, prototype: BufferPrototype, byte_range: ByteRequest | None = None

tests/test_store/test_logging.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ def test_store_supports_listing(self, store: LoggingStore) -> None:
5151
assert store.supports_listing
5252

5353
def test_store_repr(self, store: LoggingStore) -> None:
54+
assert f"{store!r}" == f"LoggingStore(LocalStore, 'file://{store._store.root.as_posix()}')"
55+
56+
def test_store_str(self, store: LoggingStore) -> None:
5457
assert str(store) == f"logging-file://{store._store.root.as_posix()}"
5558

5659
async def test_default_handler(self, local_store, capsys) -> None:

tests/test_store/test_wrapper.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ def test_store_supports_listing(self, store: WrapperStore) -> None:
5050
assert store.supports_listing
5151

5252
def test_store_repr(self, store: WrapperStore) -> None:
53+
assert f"{store!r}" == f"WrapperStore(LocalStore, 'file://{store._store.root.as_posix()}')"
54+
55+
def test_store_str(self, store: WrapperStore) -> None:
5356
assert str(store) == f"wrapping-file://{store._store.root.as_posix()}"
5457

5558
def test_is_open_setter_raises(self, store: WrapperStore) -> None:

0 commit comments

Comments
 (0)