Skip to content
Merged
Prev Previous commit
Next Next commit
Include type in NotImplementedError
  • Loading branch information
maxrjones committed Jun 18, 2025
commit 11abad120bc5f5237f49c3824b5fe6ef0ecd75d5
4 changes: 3 additions & 1 deletion src/zarr/abc/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@
-------
A new store of the same type with the new read only attribute.
"""
raise NotImplementedError("with_read_only is not implemented for this store type.")
raise NotImplementedError(

Check warning on line 100 in src/zarr/abc/store.py

View check run for this annotation

Codecov / codecov/patch

src/zarr/abc/store.py#L100

Added line #L100 was not covered by tests
f"with_read_only is not implemented for the {type(self)} store type."
)

def __enter__(self) -> Self:
"""Enter a context manager that will close the store upon exiting."""
Expand Down
3 changes: 2 additions & 1 deletion src/zarr/testing/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,13 @@
):
await reader.delete("foo")

except NotImplementedError:

Check warning on line 196 in src/zarr/testing/store.py

View check run for this annotation

Codecov / codecov/patch

src/zarr/testing/store.py#L196

Added line #L196 was not covered by tests
# Test that stores that do not implement with_read_only raise NotImplementedError with the correct message
with pytest.raises(

Check warning on line 198 in src/zarr/testing/store.py

View check run for this annotation

Codecov / codecov/patch

src/zarr/testing/store.py#L198

Added line #L198 was not covered by tests
NotImplementedError, match="with_read_only is not implemented for this store type."
NotImplementedError,
match=f"with_read_only is not implemented for the {type(store)} store type.",
):
store.with_read_only(read_only=False)

Check warning on line 202 in src/zarr/testing/store.py

View check run for this annotation

Codecov / codecov/patch

src/zarr/testing/store.py#L202

Added line #L202 was not covered by tests

@pytest.mark.parametrize("key", ["c/0", "foo/c/0.0", "foo/0/0"])
@pytest.mark.parametrize(
Expand Down
Loading