Skip to content

Commit 5c56197

Browse files
committed
test: check error states in normalize_chunks_1d
1 parent fcd5ab0 commit 5c56197

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tests/test_chunk_grids.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,21 @@ def test_resolve_outer_and_inner_chunks(
8989
assert result.inner_chunks == expected_inner
9090

9191

92+
def test_normalize_chunks_1d_errors() -> None:
93+
from zarr.core.chunk_grids import normalize_chunks_1d
94+
95+
with pytest.raises(ValueError, match="Chunk size must be positive"):
96+
normalize_chunks_1d(0, 100)
97+
with pytest.raises(ValueError, match="Chunk size must be positive"):
98+
normalize_chunks_1d(-2, 100)
99+
with pytest.raises(ValueError, match="must not be empty"):
100+
normalize_chunks_1d([], 100)
101+
with pytest.raises(ValueError, match="must be positive"):
102+
normalize_chunks_1d([10, -1, 10], 100)
103+
with pytest.raises(ValueError, match="do not sum to span"):
104+
normalize_chunks_1d([10, 20], 100)
105+
106+
92107
def test_normalize_chunks_errors() -> None:
93108
with pytest.raises(ValueError, match="does not accept None"):
94109
normalize_chunks_nd(None, (100,))

0 commit comments

Comments
 (0)