-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Empty lists shouldn't be counted as DateOffsets. See #13844 #13889
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
tests! |
Ah, sorry. Could you point me in the direction of the relevant test file? The structure is different to numpy... |
this is prob in |
Current coverage is 85.31% (diff: 100%)@@ master #13889 diff @@
==========================================
Files 139 139
Lines 50138 50143 +5
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 42769 42777 +8
+ Misses 7369 7366 -3
Partials 0 0
|
Thanks. Right I've inserted a test in each of the files you mentioned. To be honest the logical distinction between the different classes in the test files wasn't that clear to me, so please say if they are in the wrong segment. First time contributing to pandas so just finding my feet! |
@@ -598,7 +598,10 @@ def _is_offset(self, arr_or_obj): | |||
if isinstance(arr_or_obj, pd.DateOffset): | |||
return True | |||
elif is_list_like(arr_or_obj): | |||
return all(isinstance(x, pd.DateOffset) for x in arr_or_obj) | |||
if len(arr_or_obj): | |||
return all(isinstance(x, pd.DateOffset) for x in arr_or_obj) |
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 can just collapse this (meaning remove the else
clauses and just return False
at the end of the function
b = Series(dtype='m8[ns]') | ||
assert_series_equal(a, a + b) | ||
assert_series_equal(a, a - b) | ||
assert_series_equal(a, b + a) |
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 b - a
(which should raise)
minor points. ping on green. |
thanks, will amend |
lgtm. pls add a whatsnew note in Bug Fixes. |
thanks! |
git diff upstream/master | flake8 --diff