From b0f18d6cdf7419f631c1f0d632abd5903874a9e8 Mon Sep 17 00:00:00 2001 From: Abdullah Ihsan Secer Date: Sat, 2 Sep 2023 03:59:48 +0100 Subject: [PATCH 1/2] Use window parameter of test_freq_window_not_implemented --- pandas/core/indexers/objects.py | 4 +++- pandas/tests/window/test_rolling.py | 6 ++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pandas/core/indexers/objects.py b/pandas/core/indexers/objects.py index 694a420ad2494..73b898b7224c6 100644 --- a/pandas/core/indexers/objects.py +++ b/pandas/core/indexers/objects.py @@ -208,7 +208,9 @@ def get_window_bounds( step: int | None = None, ) -> tuple[np.ndarray, np.ndarray]: if step is not None: - raise NotImplementedError("step not implemented for variable offset window") + raise NotImplementedError( + "step is not supported with variable offset window" + ) if num_values <= 0: return np.empty(0, dtype="int64"), np.empty(0, dtype="int64") diff --git a/pandas/tests/window/test_rolling.py b/pandas/tests/window/test_rolling.py index f4d903dc19fb7..63738fc0236b5 100644 --- a/pandas/tests/window/test_rolling.py +++ b/pandas/tests/window/test_rolling.py @@ -99,10 +99,8 @@ def test_freq_window_not_implemented(window): np.arange(10), index=date_range("2015-12-24", periods=10, freq="D"), ) - with pytest.raises( - NotImplementedError, match="step is not supported with frequency windows" - ): - df.rolling("3D", step=3) + with pytest.raises(NotImplementedError, match="^step is not supported with"): + df.rolling(window, step=3).sum() @pytest.mark.parametrize("agg", ["cov", "corr"]) From e87d11901b1af0882469bddc95a28138accecf21 Mon Sep 17 00:00:00 2001 From: Abdullah Ihsan Secer Date: Wed, 6 Sep 2023 01:39:59 +0100 Subject: [PATCH 2/2] Revert change in exception message --- pandas/core/indexers/objects.py | 4 +--- pandas/tests/window/test_rolling.py | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandas/core/indexers/objects.py b/pandas/core/indexers/objects.py index 73b898b7224c6..694a420ad2494 100644 --- a/pandas/core/indexers/objects.py +++ b/pandas/core/indexers/objects.py @@ -208,9 +208,7 @@ def get_window_bounds( step: int | None = None, ) -> tuple[np.ndarray, np.ndarray]: if step is not None: - raise NotImplementedError( - "step is not supported with variable offset window" - ) + raise NotImplementedError("step not implemented for variable offset window") if num_values <= 0: return np.empty(0, dtype="int64"), np.empty(0, dtype="int64") diff --git a/pandas/tests/window/test_rolling.py b/pandas/tests/window/test_rolling.py index 63738fc0236b5..01a202dd1d4b6 100644 --- a/pandas/tests/window/test_rolling.py +++ b/pandas/tests/window/test_rolling.py @@ -99,7 +99,9 @@ def test_freq_window_not_implemented(window): np.arange(10), index=date_range("2015-12-24", periods=10, freq="D"), ) - with pytest.raises(NotImplementedError, match="^step is not supported with"): + with pytest.raises( + NotImplementedError, match="^step (not implemented|is not supported)" + ): df.rolling(window, step=3).sum()