-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Fix tzaware dates mismatch but no exception raised #18488
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 5 commits
213b065
1e38da4
6865239
925fede
58d5bea
3a7ec72
5374464
685b861
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 |
---|---|---|
|
@@ -290,6 +290,25 @@ def test_precision_finer_than_offset(self): | |
tm.assert_index_equal(result1, expected1) | ||
tm.assert_index_equal(result2, expected2) | ||
|
||
def test_mismatching_tz_raises_err(self): | ||
#issue 18488 | ||
dt1_tz = pd.Timestamp('2017-01-01', tz='US/Eastern') | ||
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. add the issue number here as a comment |
||
dt1_no_tz = pd.Timestamp('2017-01-01') | ||
dt2_tz = pd.Timestamp('2017-01-04', tz='US/Eastern') | ||
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 parametrize this test (IOW pass in start, end), cases for raising include:
I don't think we care about the freq here. |
||
dt2_no_tz = pd.Timestamp('2017-01-04') | ||
dt1_diff_tz = pd.Timestamp('2017-01-01', tz='Europe/London') | ||
dt2_diff_tz = pd.Timestamp('2017-01-04', tz='Europe/London') | ||
|
||
def assert_tz_raises_exception(start, end): | ||
with pytest.raises(TypeError): | ||
pd.date_range(start, end) | ||
with pytest.raises(TypeError): | ||
pd.DatetimeIndexstart(start, end) | ||
|
||
assert_tz_raises_exception(dt1_no_tz, dt2_tz) | ||
assert_tz_raises_exception(dt1_tz, dt2_no_tz) | ||
assert_tz_raises_exception(dt1_tz, dt2_diff_tz) | ||
assert_tz_raises_exception(dt1_diff_tz, dt2_tz) | ||
|
||
class TestBusinessDateRange(object): | ||
|
||
|
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 use parametrize: http://pandas.pydata.org/pandas-docs/stable/contributing.html#using-pytest