-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: parametrize sparse array arithmetic tests #27271
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
from pandas.core.sparse.api import SparseDtype | ||
import pandas.util.testing as tm | ||
|
||
|
||
@pytest.fixture(params=["integer", "block"]) | ||
def kind(request): | ||
return request.param |
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 description here as a doc-string (just a 1-liner in quotes is good)
] | ||
) | ||
def op(request): | ||
return request.param |
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.
does not all_arithmetic_operators do this?
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.
that passes the strings, which leads to different NotImplemented semantics
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.
then make a fixture which converts the existing strings to this if need be
this is duplicating things unnecessarily
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.
just moved the fixture to the top conftest, named all_arithmetic_functions
. we can't re-use the string one because that one doesnt include divmod and rdivmod.
self._assert((b_dense / a).to_dense(), b_dense * 1.0 / a_dense) | ||
if op in [operator.floordiv, ops.rfloordiv]: | ||
# FIXME: GH#13843 | ||
if self._base == pd.Series and a.dtype.subtype == np.dtype("int64"): |
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 exfail the ones that are not defined / working
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.
done; green
Codecov fail looks like false positive |
any deal-breakers here? I'd like to get this in before trying to troubleshoot the (hopefully) last division-by-zero branch |
thanks @jbrockmendel nice! |
Motivated by a tedious troubleshooting process in a different branch.
I'm pretty sure we can take this even further, saving it for another pass since the diff here is already pretty big.