()
| 1221 | |
| 1222 | |
| 1223 | def test_groupby_dataset_where() -> None: |
| 1224 | # groupby |
| 1225 | ds = Dataset({"a": ("x", range(5))}, {"c": ("x", [0, 0, 1, 1, 1])}) |
| 1226 | cond = Dataset({"a": ("c", [True, False])}) |
| 1227 | expected = ds.copy(deep=True) |
| 1228 | expected["a"].values = np.array([0, 1] + [np.nan] * 3) |
| 1229 | actual = ds.groupby("c").where(cond) |
| 1230 | assert_identical(expected, actual) |
| 1231 | |
| 1232 | # attrs with groupby |
| 1233 | ds.attrs["attr"] = "ds" |
| 1234 | ds.a.attrs["attr"] = "da" |
| 1235 | actual = ds.groupby("c").where(cond) |
| 1236 | assert actual.attrs == ds.attrs |
| 1237 | assert actual.a.name == "a" |
| 1238 | assert actual.a.attrs == ds.a.attrs |
| 1239 | |
| 1240 | |
| 1241 | def test_groupby_dataset_assign() -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…