Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas/tests/window/test_cython_aggregations.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _get_rolling_aggregations():
]
)
# unzip to a list of 2 tuples, names and functions
unzipped = list(zip(*named_roll_aggs))
unzipped = list(zip(*named_roll_aggs, strict=False))
return {"ids": unzipped[0], "params": unzipped[1]}


Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/window/test_expanding.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def test_iter_expanding_dataframe(df, expected, min_periods):
df = DataFrame(df)
expecteds = [DataFrame(values, index=index) for (values, index) in expected]

for expected, actual in zip(expecteds, df.expanding(min_periods)):
for expected, actual in zip(expecteds, df.expanding(min_periods), strict=False):
tm.assert_frame_equal(actual, expected)


Expand All @@ -199,7 +199,7 @@ def test_iter_expanding_series(ser, expected, min_periods):
# GH 11704
expecteds = [Series(values, index=index) for (values, index) in expected]

for expected, actual in zip(expecteds, ser.expanding(min_periods)):
for expected, actual in zip(expecteds, ser.expanding(min_periods), strict=False):
tm.assert_series_equal(actual, expected)


Expand Down
15 changes: 9 additions & 6 deletions pandas/tests/window/test_rolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,9 @@ def test_iter_rolling_dataframe(df, expected, window, min_periods):
df = DataFrame(df)
expecteds = [DataFrame(values, index=index) for (values, index) in expected]

for expected, actual in zip(expecteds, df.rolling(window, min_periods=min_periods)):
for expected, actual in zip(
expecteds, df.rolling(window, min_periods=min_periods), strict=False
):
tm.assert_frame_equal(actual, expected)


Expand Down Expand Up @@ -810,7 +812,7 @@ def test_iter_rolling_on_dataframe(expected, window):
expecteds = [
DataFrame(values, index=df.loc[index, "C"]) for (values, index) in expected
]
for expected, actual in zip(expecteds, df.rolling(window, on="C")):
for expected, actual in zip(expecteds, df.rolling(window, on="C"), strict=False):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this False?

Copy link
Contributor Author

@zorexsalvo zorexsalvo Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mroeschke some of the parametrize cases have mismatch lengths which when run with strict=True consistently raise test_iter_rolling_dataframe[None-expected7-2-None] - ValueError: zip() argument 2 is shorter than argument 1

One example is

(None, [({}, [])], 2, None),

None for the df means no valid rolling object, so no windows generated. But the expected side has one item.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Thanks for highlighting.

tm.assert_frame_equal(actual, expected)


Expand All @@ -819,7 +821,7 @@ def test_iter_rolling_on_dataframe_unordered():
df = DataFrame({"a": ["x", "y", "x"], "b": [0, 1, 2]})
results = list(df.groupby("a").rolling(2))
expecteds = [df.iloc[idx, [1]] for idx in [[0], [0, 2], [1]]]
for result, expected in zip(results, expecteds):
for result, expected in zip(results, expecteds, strict=False):
tm.assert_frame_equal(result, expected)


Expand Down Expand Up @@ -861,7 +863,7 @@ def test_iter_rolling_series(ser, expected, window, min_periods):
expecteds = [Series(values, index=index) for (values, index) in expected]

for expected, actual in zip(
expecteds, ser.rolling(window, min_periods=min_periods)
expecteds, ser.rolling(window, min_periods=min_periods), strict=False
):
tm.assert_series_equal(actual, expected)

Expand Down Expand Up @@ -909,10 +911,11 @@ def test_iter_rolling_datetime(expected, expected_index, window):
ser = Series(range(5), index=date_range(start="2020-01-01", periods=5, freq="D"))

expecteds = [
Series(values, index=idx) for (values, idx) in zip(expected, expected_index)
Series(values, index=idx)
for (values, idx) in zip(expected, expected_index, strict=False)
]

for expected, actual in zip(expecteds, ser.rolling(window)):
for expected, actual in zip(expecteds, ser.rolling(window), strict=False):
tm.assert_series_equal(actual, expected)


Expand Down
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -591,9 +591,6 @@ exclude = [
"pandas/tests/tseries/offsets/test_month.py" = ["B905"]
"pandas/tests/tseries/offsets/test_offsets.py" = ["B905"]
"pandas/tests/util/test_validate_kwargs.py" = ["B905"]
"pandas/tests/window/test_cython_aggregations.py" = ["B905"]
"pandas/tests/window/test_expanding.py" = ["B905"]
"pandas/tests/window/test_rolling.py" = ["B905"]
"scripts/validate_unwanted_patterns.py" = ["B905"]

[tool.ruff.lint.flake8-pytest-style]
Expand Down
Loading