Skip to content

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

Merged
merged 13 commits into from
Jul 9, 2019

Conversation

jbrockmendel
Copy link
Member

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.

from pandas.core.sparse.api import SparseDtype
import pandas.util.testing as tm


@pytest.fixture(params=["integer", "block"])
def kind(request):
return request.param
Copy link
Contributor

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
Copy link
Contributor

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?

Copy link
Member Author

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

Copy link
Contributor

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

Copy link
Member Author

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"):
Copy link
Contributor

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

Copy link
Member Author

Choose a reason for hiding this comment

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

done; green

@jreback jreback added Sparse Sparse Data Type Testing pandas testing functions or related to the test suite labels Jul 7, 2019
@jbrockmendel
Copy link
Member Author

Codecov fail looks like false positive

@jbrockmendel
Copy link
Member Author

any deal-breakers here? I'd like to get this in before trying to troubleshoot the (hopefully) last division-by-zero branch

@jreback jreback added this to the 0.25.0 milestone Jul 9, 2019
@jreback jreback merged commit f38020f into pandas-dev:master Jul 9, 2019
@jreback
Copy link
Contributor

jreback commented Jul 9, 2019

thanks @jbrockmendel nice!

@jbrockmendel jbrockmendel deleted the sparam branch July 10, 2019 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Sparse Sparse Data Type Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants