-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
TST: added test for pd.where overflow error GH31687 #49926
TST: added test for pd.where overflow error GH31687 #49926
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 for working on this!
|
||
|
||
@pytest.mark.parametrize( | ||
"replacement", [0.001, True, "snake", DATETIME_JAN_1_1900_OPTIONAL_TZ] |
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.
DATETIME_JAN_1_1900_OPTIONAL_TZ
is gonna be a LazyStrategy
object here, which I guess isn't quite what you wanted, I think you'll need @given
to use hypothesis tests
Not sure we need that though, just some date should be fine if you want to test using a date as a replacement
Also, the original issue used None
, shall we include that?
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.
You're right, I didn't want a LazyStrategy object! I'll change that to a date, and also include None to align better with the original issue. I was also wondering if there was already a quick way to test all scalar types rather than having to use a long parametrized list. Or would that be overkill?
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.
yeah I think just keeping the original snippet from the issue as a test should be fine
) | ||
def test_where_int_overflow(replacement): | ||
# GH 31687 | ||
df = DataFrame([[1.0, 2e19, "nine"], [np.nan, 0.1, None]]) |
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.
ideally for regression tests it's better to keep them as close as possible to the original - any reason to use 2e19
instead of 2e25
?
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.
I think I reduced it down to the smallest order of magnitude that still had the problem in pandas 1.4.1, but I don't have strong feelings about using that instead of the 2e25 from the original.
abc954c
to
48f81cd
Compare
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 @mliu08 !
Added a test for pd.where to /indexing/test_where.py
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.