Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1086,10 +1086,14 @@ async def test_open_falls_back_to_open_group_async() -> None:
assert group.attrs == {"key": "value"}


def test_open_mode_write_creates_group(tmp_path: pathlib.Path) -> None:
@pytest.mark.parametrize("mode", ["w", "a"])
def test_open_write_modes_creates_group(tmp_path: pathlib.Path, mode: str) -> None:
# https://github.com/zarr-developers/zarr-python/issues/2490
zarr_dir = tmp_path / "test.zarr"
group = zarr.open(zarr_dir, mode="w")
zarr_dir = tmp_path / f"{mode}-test.zarr"
if mode in ["r", "r+"]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block won't every be executed, because the mode is only 'w' or 'a' in this test. Do you think we should get rid of the if block, or extend the parameterisation to include 'r' and 'r+'?

# If read modes, create a zarr store first.
zarr.open(zarr_dir, mode="w")
group = zarr.open(zarr_dir, mode=mode)
assert isinstance(group, Group)


Expand Down
Loading