Skip to content

GH1671 Improve testing for Transformation/Reduction methods on Groupby#1672

Open
loicdiridollou wants to merge 1 commit intopandas-dev:mainfrom
loicdiridollou:gh1671_reduction_kernel
Open

GH1671 Improve testing for Transformation/Reduction methods on Groupby#1672
loicdiridollou wants to merge 1 commit intopandas-dev:mainfrom
loicdiridollou:gh1671_reduction_kernel

Conversation

@loicdiridollou
Copy link
Member

Comment on lines +937 to +938
with pytest_warns_bounded(Pandas4Warning, "corrwith is deprecated", lower="2.99"):
check(assert_type(GB_DF.transform("corrwith", other=DF), DataFrame), DataFrame)
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't support 2.x anymore, do we?

Copy link
Member Author

Choose a reason for hiding this comment

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

in pytest_warns_bounded the check for version is strict so if you put 3.0 it will not trigger for the 3.0 version, that way I am forced to stick to 2.99. (we had the issue in a different PR).


def test_frame_groupby_transform_reduction_kernels() -> None:
"""Test DataFrameGroupBy.transform with ReductionKernelType literals."""
check(assert_type(GB_DF.transform("all"), DataFrame), DataFrame)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think for DataFrame.transform, all str's are accepted by the stubs at the moment. Shall we switch to a Literal and also add one or two negative tests in TYPE_CHECKING_INVALID_USAGE?

Copy link
Member Author

Choose a reason for hiding this comment

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

Happy to make the switch, I was just worried there are some functions not in the list and we would break for the user. What do you think? Should we take the risk?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Complete tests for ReductionKernelType

2 participants