Skip to content

Commit bdb999f

Browse files
committed
fix tests
1 parent e1ba8a2 commit bdb999f

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

xarray/core/groupby.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,9 @@ def _flox_reduce(self, dim, **kwargs):
552552
# TODO: switch to xindexes after we can use is_unique
553553
index = self._obj.indexes[self._group.name]
554554
if index.is_unique and self._squeeze:
555-
raise ValueError(f"cannot reduce over dimensions {self._group.name!r}")
555+
raise ValueError(
556+
f"Cannot reduce over absent dimensions {self._group.name!r}"
557+
)
556558

557559
# TODO: only do this for resample, not general groupers...
558560
# this creates a label DataArray since resample doesn't do that somehow

xarray/tests/test_groupby.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,13 +514,13 @@ def test_groupby_grouping_errors() -> None:
514514

515515
def test_groupby_reduce_dimension_error(array) -> None:
516516
grouped = array.groupby("y")
517-
with pytest.raises(ValueError, match=r"cannot reduce over dimensions"):
517+
with pytest.raises(ValueError, match=r"Cannot reduce over absent dimensions"):
518518
grouped.mean()
519519

520-
with pytest.raises(ValueError, match=r"cannot reduce over dimensions"):
520+
with pytest.raises(ValueError, match=r"Cannot reduce over absent dimensions"):
521521
grouped.mean("huh")
522522

523-
with pytest.raises(ValueError, match=r"cannot reduce over dimensions"):
523+
with pytest.raises(ValueError, match=r"Cannot reduce over absent dimensions"):
524524
grouped.mean(("x", "y", "asd"))
525525

526526
grouped = array.groupby("y", squeeze=False)
@@ -1656,7 +1656,7 @@ def test_resample_min_count(self):
16561656
],
16571657
dim=actual["time"],
16581658
)
1659-
assert_equal(expected, actual)
1659+
assert_allclose(expected, actual)
16601660

16611661
def test_resample_by_mean_with_keep_attrs(self):
16621662
times = pd.date_range("2000-01-01", freq="6H", periods=10)

0 commit comments

Comments
 (0)