-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
TST/CLN: Consolidate creation of groupby method args #47973
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
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.
Thanks @rhshadrach lgtm
As a rule I do not see changing tests as necessarily a benefit. Parameterizing most definitely so that we can test more for consistency.
If it was not for the passing of obj
to the helper function, I would not even have mentioned it as it could potentially have made a good composite fixture.
pandas/tests/groupby/__init__.py
Outdated
@@ -0,0 +1,10 @@ | |||
def get_method_args(name, obj): |
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.
can you add a one-liner docstring here
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.
Thanks - good idea. I ended up doing a full docstring.
Thanks @rhshadrach lgtm. and no documentation is too much (imo) so that we are more casual contributor friendly. merge when green. |
For me, sometimes one of the difficult parts of doing a PR is just figuring out where a test should go. In the same vein as documentation, I think making tests easier to write would be a way to make pandas more contributor friendly. So I do think cleaning up tests where possible would be a benefit. In fact, I've spent quite some effort trying to figure out ways to better organize and write groupby tests because of this, but rarely do I find a change that's worth doing. The trouble is there are so many ways to parametrize, and how best to do it really depends on the test:
Various tests parametrize over one or multiple of these, and many more don't parametrize at all but probably should. I've never been able to find a good way to organize tests for parametrizations, but would strongly feel we should refactor if there was one. |
Thanks @rhshadrach (failure unrelated). My 2c: I think test cleanup can be worth it if it's:
I think creating a "groupby testing parameterization matrix" of grouping objects x object dtypes x groupby methods x method arguments would be really nice to have running (although maybe redundant with some existing tests), but it would probably be best for it to be a new testing file instead of augmenting what already exists. |
Thanks @simonjayhawkins and @mroeschke for sharing your thoughts. |
* TST/CLN: Consolidate creation of groupby method args * Rename to get_groupby_method_args Co-authored-by: asv-bot <pandas.benchmarks@gmail.com>
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.Wasn't sure if it was better to put the helper in
__init__
or createcommon
.