Skip to content

Commit

Permalink
Match error message
Browse files Browse the repository at this point in the history
  • Loading branch information
maxrjones committed Jan 23, 2025
1 parent 0d6eccf commit 9059135
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/zarr/storage/_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __init__(self, root: Path | str, *, read_only: bool = False) -> None:
root = Path(root)
if not isinstance(root, Path):
raise TypeError(
f'"root" must be a string or Path instance. Got an object with type {type(root)} instead.'
f"'root' must be a string or Path instance. Got an instance of {type(root)} instead."
)
self.root = root

Expand Down
5 changes: 4 additions & 1 deletion tests/test_store/test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ def test_invalid_root_raises(self):
"""
Test that a TypeError is raised when a non-str/Path type is used for the `root` argument
"""
with pytest.raises(TypeError):
with pytest.raises(
TypeError,
match=r"'root' must be a string or Path instance. Got an instance of <class 'int'> instead.",
):
LocalStore(root=0)

async def test_get_with_prototype_default(self, store: LocalStore):
Expand Down

0 comments on commit 9059135

Please sign in to comment.