Skip to content

Commit c00e2cb

Browse files
authored
Merge branch 'main' into doc/2733-store-imports
2 parents 0ee5ba7 + fae8fb9 commit c00e2cb

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ci:
66
default_stages: [pre-commit, pre-push]
77
repos:
88
- repo: https://github.com/astral-sh/ruff-pre-commit
9-
rev: v0.9.4
9+
rev: v0.9.9
1010
hooks:
1111
- id: ruff
1212
args: ["--fix", "--show-fixes"]
@@ -22,7 +22,7 @@ repos:
2222
- id: check-yaml
2323
- id: trailing-whitespace
2424
- repo: https://github.com/pre-commit/mirrors-mypy
25-
rev: v1.14.1
25+
rev: v1.15.0
2626
hooks:
2727
- id: mypy
2828
files: src|tests

tests/test_api.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def test_save(store: Store, n_args: int, n_kwargs: int) -> None:
209209
assert isinstance(array, Array)
210210
assert_array_equal(array[:], data)
211211
else:
212-
save(store, *args, **kwargs) # type: ignore[arg-type]
212+
save(store, *args, **kwargs) # type: ignore [arg-type]
213213
group = open(store)
214214
assert isinstance(group, Group)
215215
for array in group.array_values():
@@ -1095,25 +1095,31 @@ async def test_open_falls_back_to_open_group_async() -> None:
10951095
assert group.attrs == {"key": "value"}
10961096

10971097

1098-
def test_open_mode_write_creates_group(tmp_path: pathlib.Path) -> None:
1098+
@pytest.mark.parametrize("mode", ["r", "r+", "w", "a"])
1099+
def test_open_modes_creates_group(tmp_path: pathlib.Path, mode: str) -> None:
10991100
# https://github.com/zarr-developers/zarr-python/issues/2490
1100-
zarr_dir = tmp_path / "test.zarr"
1101-
group = zarr.open(zarr_dir, mode="w")
1102-
assert isinstance(group, Group)
1101+
zarr_dir = tmp_path / f"mode-{mode}-test.zarr"
1102+
if mode in ["r", "r+"]:
1103+
# Expect FileNotFoundError to be raised if 'r' or 'r+' mode
1104+
with pytest.raises(FileNotFoundError):
1105+
zarr.open(store=zarr_dir, mode=mode)
1106+
else:
1107+
group = zarr.open(store=zarr_dir, mode=mode)
1108+
assert isinstance(group, Group)
11031109

11041110

11051111
async def test_metadata_validation_error() -> None:
11061112
with pytest.raises(
11071113
MetadataValidationError,
11081114
match="Invalid value for 'zarr_format'. Expected '2, 3, or None'. Got '3.0'.",
11091115
):
1110-
await zarr.api.asynchronous.open_group(zarr_format="3.0") # type: ignore[arg-type]
1116+
await zarr.api.asynchronous.open_group(zarr_format="3.0") # type: ignore [arg-type]
11111117

11121118
with pytest.raises(
11131119
MetadataValidationError,
11141120
match="Invalid value for 'zarr_format'. Expected '2, 3, or None'. Got '3.0'.",
11151121
):
1116-
await zarr.api.asynchronous.open_array(shape=(1,), zarr_format="3.0") # type: ignore[arg-type]
1122+
await zarr.api.asynchronous.open_array(shape=(1,), zarr_format="3.0") # type: ignore [arg-type]
11171123

11181124

11191125
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)