(chunks, expected_chunks)
| 3385 | ], |
| 3386 | ) |
| 3387 | def test_shuffle_by(chunks, expected_chunks): |
| 3388 | import dask.array |
| 3389 | |
| 3390 | da = xr.DataArray( |
| 3391 | dims="x", |
| 3392 | data=dask.array.arange(10, chunks=chunks), |
| 3393 | coords={"x": [1, 2, 3, 1, 2, 3, 1, 2, 3, 0]}, |
| 3394 | name="a", |
| 3395 | ) |
| 3396 | ds = da.to_dataset() |
| 3397 | |
| 3398 | for obj in [ds, da]: |
| 3399 | actual = obj.groupby(x=UniqueGrouper()).shuffle_to_chunks() |
| 3400 | assert_identical(actual, obj.sortby("x")) |
| 3401 | assert actual.chunksizes["x"] == expected_chunks |
| 3402 | |
| 3403 | |
| 3404 | @requires_dask |
nothing calls this directly
no test coverage detected
searching dependent graphs…