Skip to content

Commit c8ebcd0

Browse files
maxrjonesd-v-b
andcommitted
Parametrize tests
Co-authored-by: Davis Bennett <[email protected]>
1 parent 74647de commit c8ebcd0

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

tests/test_store/test_core.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,14 @@ async def test_contains_array(local_store, write_array: bool, zarr_format: ZarrF
3737
assert await contains_array(store_path, zarr_format=zarr_format) == write_array
3838

3939

40-
async def test_contains_invalid_format_raises(local_store) -> None:
40+
@pytest.mark.parametrize("func", [contains_array, contains_group])
41+
async def test_contains_invalid_format_raises(local_store, func: callable) -> None:
4142
"""
4243
Test contains_group and contains_array raise errors for invalid zarr_formats
4344
"""
4445
store_path = StorePath(local_store)
4546
with pytest.raises(ValueError):
46-
assert await contains_group(store_path, zarr_format="3.0")
47-
with pytest.raises(ValueError):
48-
assert await contains_array(store_path, zarr_format="3.0")
47+
assert await func(store_path, zarr_format="3.0")
4948

5049

5150
@pytest.mark.parametrize("path", [None, "", "bar"])
@@ -97,14 +96,13 @@ async def test_make_store_path_store_path(
9796
assert store_path.read_only == ro
9897

9998

100-
async def test_store_path_invalid_mode_raises(tmpdir: LEGACY_PATH) -> None:
99+
@pytest.mark.parametrize("modes", [(True, "w"), (False, "x")])
100+
async def test_store_path_invalid_mode_raises(tmpdir: LEGACY_PATH, modes: tuple) -> None:
101101
"""
102102
Test that ValueErrors are raise for invalid mode.
103103
"""
104104
with pytest.raises(ValueError):
105-
await StorePath.open(LocalStore(str(tmpdir), read_only=True), path=None, mode="w")
106-
with pytest.raises(ValueError):
107-
await StorePath.open(LocalStore(str(tmpdir), read_only=False), path=None, mode="x")
105+
await StorePath.open(LocalStore(str(tmpdir), read_only=modes[0]), path=None, mode=modes[1])
108106

109107

110108
async def test_make_store_path_invalid() -> None:

0 commit comments

Comments
 (0)