MCPcopy
hub / github.com/pydata/xarray / test_lazy_grouping_errors

Function test_lazy_grouping_errors

xarray/tests/test_groupby.py:3250–3270  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3248
3249@requires_dask
3250def test_lazy_grouping_errors() -> None:
3251 import dask.array
3252
3253 data = DataArray(
3254 dims=("x",),
3255 data=dask.array.arange(20, chunks=3),
3256 name="foo",
3257 coords={"y": ("x", dask.array.arange(20, chunks=3))},
3258 )
3259
3260 gb = data.groupby(y=UniqueGrouper(labels=np.arange(5, 10)))
3261 message = "not supported when lazily grouping by"
3262 with pytest.raises(ValueError, match=message):
3263 gb.map(lambda x: x)
3264
3265 with pytest.raises(ValueError, match=message):
3266 gb.reduce(np.mean)
3267
3268 with pytest.raises(ValueError, match=message):
3269 for _, _ in gb:
3270 pass
3271
3272
3273@requires_dask

Callers

nothing calls this directly

Calls 6

groupbyMethod · 0.95
DataArrayClass · 0.90
UniqueGrouperClass · 0.90
arangeMethod · 0.80
mapMethod · 0.45
reduceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…