Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ extend-select = [
ignore = [
"ANN401",
"PT011", # TODO: apply this rule
"PT012", # TODO: apply this rule
"PT030", # TODO: apply this rule
"PT031", # TODO: apply this rule
"RET505",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ def test_save_errors() -> None:
with pytest.raises(ValueError):
# no arrays provided
save("data/group.zarr")
a = np.arange(10)
with pytest.raises(TypeError):
# mode is no valid argument and would get handled as an array
a = np.arange(10)
zarr.save("data/example.zarr", a, mode="w")


Expand Down
2 changes: 1 addition & 1 deletion tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ async def write(

_mock.call.assert_called()

config.set({"codec_pipeline.path": "wrong_name"})
with pytest.raises(BadConfigError):
config.set({"codec_pipeline.path": "wrong_name"})
get_pipeline_class()

class MockEnvCodecPipeline(CodecPipeline):
Expand Down
7 changes: 4 additions & 3 deletions tests/test_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,12 +655,13 @@ def test_group_create_array(

if not overwrite:
if method == "create_array":
with pytest.raises(ContainsArrayError):
with pytest.raises(ContainsArrayError): # noqa: PT012
a = group.create_array(name=name, shape=shape, dtype=dtype)
a[:] = data
elif method == "array":
with pytest.raises(ContainsArrayError), pytest.warns(DeprecationWarning):
a = group.array(name=name, shape=shape, dtype=dtype)
with pytest.raises(ContainsArrayError): # noqa: PT012
with pytest.warns(DeprecationWarning):
a = group.array(name=name, shape=shape, dtype=dtype)
a[:] = data

assert array.path == normalize_path(name)
Expand Down
20 changes: 10 additions & 10 deletions tests/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1093,17 +1093,17 @@ def test_get_coordinate_selection_2d(store: StorePath) -> None:
ix1 = np.array([[1, 3, 2], [1, 0, 0]])
_test_get_coordinate_selection(a, z, (ix0, ix1))

selection = slice(5, 15), [1, 2, 3]
with pytest.raises(IndexError):
selection = slice(5, 15), [1, 2, 3]
z.get_coordinate_selection(selection) # type:ignore[arg-type]
selection = [1, 2, 3], slice(5, 15)
with pytest.raises(IndexError):
selection = [1, 2, 3], slice(5, 15)
z.get_coordinate_selection(selection) # type:ignore[arg-type]
selection = Ellipsis, [1, 2, 3]
with pytest.raises(IndexError):
selection = Ellipsis, [1, 2, 3]
z.get_coordinate_selection(selection) # type:ignore[arg-type]
selection = Ellipsis
with pytest.raises(IndexError):
selection = Ellipsis
z.get_coordinate_selection(selection) # type:ignore[arg-type]


Expand Down Expand Up @@ -1299,14 +1299,14 @@ def test_get_block_selection_2d(store: StorePath) -> None:
):
_test_get_block_selection(a, z, selection, expected_idx)

selection = slice(5, 15), [1, 2, 3]
with pytest.raises(IndexError):
selection = slice(5, 15), [1, 2, 3]
z.get_block_selection(selection)
selection = Ellipsis, [1, 2, 3]
with pytest.raises(IndexError):
selection = Ellipsis, [1, 2, 3]
z.get_block_selection(selection)
selection = slice(15, 20), slice(None)
with pytest.raises(IndexError): # out of bounds
selection = slice(15, 20), slice(None)
z.get_block_selection(selection)


Expand Down Expand Up @@ -1360,14 +1360,14 @@ def test_set_block_selection_2d(store: StorePath) -> None:
):
_test_set_block_selection(v, a, z, selection, expected_idx)

selection = slice(5, 15), [1, 2, 3]
with pytest.raises(IndexError):
selection = slice(5, 15), [1, 2, 3]
z.set_block_selection(selection, 42)
selection = Ellipsis, [1, 2, 3]
with pytest.raises(IndexError):
selection = Ellipsis, [1, 2, 3]
z.set_block_selection(selection, 42)
selection = slice(15, 20), slice(None)
with pytest.raises(IndexError): # out of bounds
selection = slice(15, 20), slice(None)
z.set_block_selection(selection, 42)


Expand Down
Loading