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

Function test_groupby_reduce_dimension_error

xarray/tests/test_groupby.py:774–791  ·  view source on GitHub ↗
(array)

Source from the content-addressed store, hash-verified

772
773
774def test_groupby_reduce_dimension_error(array) -> None:
775 grouped = array.groupby("y")
776 # assert_identical(array, grouped.mean())
777
778 with pytest.raises(ValueError, match=r"cannot reduce over dimensions"):
779 grouped.mean("huh")
780
781 with pytest.raises(ValueError, match=r"cannot reduce over dimensions"):
782 grouped.mean(("x", "y", "asd"))
783
784 assert_identical(array.mean("x"), grouped.reduce(np.mean, "x"))
785 assert_allclose(array.mean(["x", "z"]), grouped.reduce(np.mean, ["x", "z"]))
786
787 grouped = array.groupby("y")
788 assert_identical(array, grouped.mean())
789
790 assert_identical(array.mean("x"), grouped.reduce(np.mean, "x"))
791 assert_allclose(array.mean(["x", "z"]), grouped.reduce(np.mean, ["x", "z"]))
792
793
794def test_groupby_multiple_string_args(array) -> None:

Callers

nothing calls this directly

Calls 5

assert_identicalFunction · 0.90
assert_allcloseFunction · 0.90
groupbyMethod · 0.45
meanMethod · 0.45
reduceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…