| 5132 | ], |
| 5133 | ) |
| 5134 | def test_zarr_irregular_chunks(shape, chunks, expect_rechunk): |
| 5135 | pytest.importorskip("zarr") |
| 5136 | with tmpdir() as d: |
| 5137 | a = da.zeros(shape, chunks=chunks) # ((2, 1, 1, 2), 1)) |
| 5138 | if expect_rechunk: |
| 5139 | with pytest.warns(UserWarning, match="The array uses irregular chunk"): |
| 5140 | store_delayed = a.to_zarr(d, component="test", compute=False) |
| 5141 | else: |
| 5142 | store_delayed = a.to_zarr(d, component="test", compute=False) |
| 5143 | assert ( |
| 5144 | any("rechunk" in key_split(k) for k in dict(store_delayed.dask)) |
| 5145 | is expect_rechunk |
| 5146 | ) |
| 5147 | store_delayed.compute() |
| 5148 | |
| 5149 | |
| 5150 | @pytest.mark.parametrize( |