Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TST: Extend timedelta64 arithmetic tests to TimedeltaArray #23642
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
TST: Extend timedelta64 arithmetic tests to TimedeltaArray #23642
Changes from 8 commits
e6463be
f5a7891
291dd51
52319fd
da1b45a
0b21797
cb63fe7
6ccff81
1ffc21f
8c9f296
3c53183
74046ba
1c9fb1a
9f4d4d9
07c858e
b8e2127
6dd6b3b
9c11a6c
e4c7e98
cf97665
62edbc3
fa3e8d1
4cc3cbd
2df7d65
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
we should use the already existing machinery and simply implement this
_create_arithmetic_method
and a limited form of:
otherwise you have different styles here than elsewhere.
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.
We use this pattern in plenty of places: nattype, Timedelta, field accessors TDA/DTA/PA, ... Using the classmethod in this context doesn't add anything except a layer of indirection.
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.
right but that'st the point, we should be using this here as this IS using the mixin that implements this. This is creating yet another pattern.
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.
No, it isn't. It inherits from ExtensionOpsMixin to use _add_comparison_comps, NOT _add_arithmetic_ops. In fact if were to try to use _add_arithmetic_ops that would be working at cross-purposes with
_add_datetimelike_methods
, which specifically implements add/sub-like methods.I'm as big a fan of internal consistency and de-duplication as the next guy, but this isn't the place to make that stand.
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.
@jreback ok for now?
(anyway, I think the goal is to rework this a bit at some point, to not wrap TimedeltaIndex here, rather the other way around)
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.
Correct
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.
how are you implmenting rfloordiv but not rdiv / rtruediv?
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.
very specifically implementing only the methods needed to extend the affected tests. I'll double-check why i couldn't extend tests for rdiv and rtruediv
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.
ok
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.
@jbrockmendel any findings here?
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.
AFAICT we don't have test cases for the other methods, at least not in tests.arithmetic.test_timedelta64. I've scoured the other test files to centralize arithmetic tests, but it's conceivable I've missed some.
We definitely need such tests, but I'd rather do that in a dedicated PR, and would prefer not to implement the methods here without the corresponding tests.
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.
+1