-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: silent overflow in DateTimeArray subtraction #22508
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1570,6 +1570,27 @@ def test_datetimeindex_sub_timestamp_overflow(self): | |
with pytest.raises(OverflowError): | ||
dtimin - variant | ||
|
||
def test_datetimeindex_sub_datetimeindex_overflow(self): | ||
dtimax = pd.to_datetime(['now', pd.Timestamp.max]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you add a comment with the issue number |
||
dtimin = pd.to_datetime(['now', pd.Timestamp.min]) | ||
|
||
ts_neg = pd.to_datetime(['1950-01-01', '1950-01-01']) | ||
ts_pos = pd.to_datetime(['1980-01-01', '1980-01-01']) | ||
|
||
with pytest.raises(OverflowError): | ||
dtimax - ts_neg | ||
|
||
expected = pd.Timestamp.max.value - ts_pos[1].value | ||
res = dtimax - ts_pos | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use result (rather than res) in all occurrences |
||
assert res[1].value == expected | ||
|
||
expected = pd.Timestamp.min.value - ts_neg[1].value | ||
res = dtimin - ts_neg | ||
assert res[1].value == expected | ||
|
||
with pytest.raises(OverflowError): | ||
dtimin - ts_pos | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you add a comment or 2 to delineate the various cases |
||
|
||
@pytest.mark.parametrize('names', [('foo', None, None), | ||
('baz', 'bar', None), | ||
('bar', 'bar', 'bar')]) | ||
|
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 little more here, e.g. when this fails to raise