-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: GH34037 add test for type error when using parameter 'min_period' #42940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
horaceklai
commented
Aug 8, 2021
•
edited by mroeschke
Loading
edited by mroeschke
- closes BUG: "min_period" and "min_periods" problem in df.groupby().rolling #34037
- [ x] tests added / passed
- [x ] Ensure all linting tests pass, see here for how to run them
- whatsnew entry
pandas/tests/groupby/test_groupby.py
Outdated
@@ -2407,3 +2407,19 @@ def test_datetime_categorical_multikey_groupby_indices(): | |||
("c", Timestamp("2018-03-01 00:00:00")): np.array([2]), | |||
} | |||
assert result == expected | |||
|
|||
|
|||
def test_rolling_min_period(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to mention in this function title that min_period
is incorrect
pandas/tests/groupby/test_groupby.py
Outdated
test_df.columns = ["name", "val"] | ||
|
||
# correct one | ||
test_df.groupby("name")["val"].rolling(window=2, min_periods=1).sum() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need to test this line
pandas/tests/groupby/test_groupby.py
Outdated
# GH34037 | ||
result_error_msg = r"__init__\(\) got an unexpected keyword argument 'min_period'" | ||
with pytest.raises(TypeError, match=result_error_msg): | ||
name_l = ["Alice"] * 5 + ["Bob"] * 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the setup code should ideally be before the pytest.raises
call
98ca0d9
to
5c61723
Compare
Thanks @horaceklai |