-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: add iso-format support to to_timedelta (#21877) #21933
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
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 an indexing test as well to make sure the function appropriately handles multiple timedeltas?
Codecov Report
@@ Coverage Diff @@
## master #21933 +/- ##
==========================================
+ Coverage 91.96% 91.96% +<.01%
==========================================
Files 166 166
Lines 50323 50329 +6
==========================================
+ Hits 46281 46287 +6
Misses 4042 4042
Continue to review full report at Codecov.
|
def test_constructor_iso(self): | ||
expected = timedelta_range('1s', periods=9, freq='s') | ||
durations = ['P0DT0H0M{}S'.format(i) for i in range(1, 10)] | ||
tm.assert_index_equal(to_timedelta(durations), expected) |
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.
Minor nit but we have a pseudo-standard of doing tm.assert_index_equal(result, expected)
so would be nice to assign to a variable called result
in the line above and simply do the comparison on the last line
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.
More importantly, you should reference the issue number in a comment beyond the function def
line.
Same applies to all tests that you have added.
@fjdiod : Could you also a |
@@ -233,6 +233,11 @@ def check(value): | |||
assert tup.microseconds == 999 | |||
assert tup.nanoseconds == 0 | |||
|
|||
def test_iso_convertion(self): |
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.
Minor typo of the word conversion
if you care to fix up
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.
Should I push a fix for it?
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.
Go for it
thanks @fjdiod |
Go for it - thanks! |
git diff upstream/master -u -- "*.py" | flake8 --diff