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

Method test_groupby_properties

xarray/tests/test_groupby.py:1332–1344  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1330 assert_identical(exp_dv, act_dv)
1331
1332 def test_groupby_properties(self) -> None:
1333 grouped = self.da.groupby("abc")
1334 expected_groups = {"a": range(9), "c": [9], "b": range(10, 20)}
1335 assert expected_groups.keys() == grouped.groups.keys()
1336 for key, expected_group in expected_groups.items():
1337 actual_group = grouped.groups[key]
1338
1339 # TODO: array_api doesn't allow slice:
1340 assert not isinstance(expected_group, slice)
1341 assert not isinstance(actual_group, slice)
1342
1343 np.testing.assert_array_equal(expected_group, actual_group)
1344 assert 3 == len(grouped)
1345
1346 @pytest.mark.parametrize(
1347 "by, use_da", [("x", False), ("y", False), ("y", True), ("abc", False)]

Callers

nothing calls this directly

Calls 3

keysMethod · 0.80
itemsMethod · 0.80
groupbyMethod · 0.45

Tested by

no test coverage detected