-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ERR: Clarify exceptions for invalid datetimelike operations #17772
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
Conversation
Let the exception be raised from _add_datelike
Seemed too small a change for a what's new note |
Codecov Report
@@ Coverage Diff @@
## master #17772 +/- ##
==========================================
- Coverage 91.26% 91.24% -0.02%
==========================================
Files 163 163
Lines 49872 49976 +104
==========================================
+ Hits 45514 45601 +87
- Misses 4358 4375 +17
Continue to review full report at Codecov.
|
with tm.assert_raises_regex(TypeError, msg): | ||
idx + Timestamp('2011-01-01') | ||
|
||
with tm.assert_raises_regex(TypeError, msg): | ||
Timestamp('2011-01-01') + idx | ||
|
||
def test_add_dti_ts(self): | ||
dti = DatetimeIndex(['2011-01-01', '2011-01-02']) |
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.
add the issue number as a comment
def test_add_dti_ts(self): | ||
dti = DatetimeIndex(['2011-01-01', '2011-01-02']) | ||
ts = Timestamp('2011-01-01') | ||
msg = 'cannot add DatetimeIndex and Timestamp' |
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 combine these into a single tests and use parametrize for the args
some comments. ping when pushed and green. skipping whatsnew is fine. |
Combine multiple tests using parametrize Add issue number in the comment
@jreback addressed all comments, tests pass |
|
||
with pytest.raises(TypeError): | ||
dti_tz + dti | ||
|
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.
hmm I think you removed the dti_tz + dti_tz
tests (IOW a tz-aware interacting with a non-tzaware). these can be a separate test function. also add a datetime scalar addend.
Prettify test_add_dti_dti Add datetime object to test_add_datetimelike params
dti = date_range('20110101', periods=3) | ||
combinations = product((dti_tz, dti), repeat=2) | ||
|
||
msg = 'cannot add DatetimeIndex and DatetimeIndex' |
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 u parametrize this as well
Rename test functions
thanks @mturzanska |
closes #9631