def test_split_array_chunks__raise_on_blocks_gt_n(): with pytest.raises( ValueError, match= r"Number of blocks .* cannot be greater than number of elements", ): split_array_chunks(3, 10)
def test_split_array_chunks__raise_on_n_lte_0(): with pytest.raises(ValueError, match=r"Number of elements .* must be >= 0"): split_array_chunks(0, 0)
def test_split_array_chunks__raise_on_blocks_lte_0(): with pytest.raises(ValueError, match=r"Number of blocks .* must be >= 0"): split_array_chunks(3, 0)
def test_split_array_chunks__size(a: int, b: int) -> None: res = split_array_chunks(a + b, a) assert sum(res) == a + b assert len(res) == a
def test_split_array_chunks__precomputed(n: int, blocks: int, expected_chunks: List[int]) -> None: assert split_array_chunks(n, blocks) == tuple(expected_chunks)