-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Updating and re-opening PR #48129 #50541
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 all commits
bab1995
c62dde3
ee8752f
ea1db06
e91a1d8
4179d58
c43f2be
d79646b
0fcf0fd
21ed3c4
ff0bd57
71ef3d2
b9a5479
7672f40
073b187
fc50014
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 |
---|---|---|
|
@@ -30,6 +30,8 @@ | |
YearEnd, | ||
) | ||
|
||
import pandas as pd | ||
import pandas._testing as tm | ||
from pandas.util.version import Version | ||
|
||
# error: Module has no attribute "__version__" | ||
|
@@ -233,3 +235,30 @@ def test_nontick_offset_with_ambiguous_time_error(original_dt, target_dt, offset | |
msg = f"Cannot infer dst time from {target_dt}, try using the 'ambiguous' argument" | ||
with pytest.raises(pytz.AmbiguousTimeError, match=msg): | ||
localized_dt + offset | ||
|
||
|
||
def test_series_dst_addition(): | ||
# GH#43784 | ||
startdates = pd.Series( | ||
[ | ||
Timestamp("2020-10-25", tz="Europe/Berlin"), | ||
Timestamp("2017-03-12", tz="US/Pacific"), | ||
] | ||
) | ||
offset1 = DateOffset(hours=3) | ||
offset2 = DateOffset(days=1) | ||
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. looks like this only tests the DateOffset class, for which _use_relativedelta can be True. but the code you changed affects a bunch of other classes 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. Alright, I'll try and work on some tests for the other classes. |
||
|
||
expected1 = pd.Series( | ||
[Timestamp("2020-10-25 02:00:00+01:00"), Timestamp("2017-03-12 04:00:00-07:00")] | ||
) | ||
|
||
expected2 = pd.Series( | ||
[Timestamp("2020-10-26 00:00:00+01:00"), Timestamp("2017-03-13 00:00:00-07:00")] | ||
) | ||
|
||
result1 = startdates + offset1 | ||
result2 = startdates + offset2 | ||
|
||
tm.assert_series_equal(result1, expected1) | ||
|
||
tm.assert_series_equal(result2, expected2) |
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.
is there a viable way to handle this inside the Offset code? in theory the DTA code shouldn't need to know anything about _use_relativedelta
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.
The issue is with how these dates are localized, and I don't believe there is a good way to modify this in the Offset code.