BUG: Raise warning for integer arithmetic with timedelta64/datetime64 arrays#31290
Open
may12day wants to merge 3 commits intonumpy:mainfrom
Open
BUG: Raise warning for integer arithmetic with timedelta64/datetime64 arrays#31290may12day wants to merge 3 commits intonumpy:mainfrom
may12day wants to merge 3 commits intonumpy:mainfrom
Conversation
e3ced45 to
159d053
Compare
Member
|
Please run the test suite and make sure it passes locally. Feel free to turn on CI for your fork if you want to have it run without us pressing any approval buttons. Ping @riku-sakamoto in case you want to take a look. |
|
|
||
| class TestDeprecatedIntegerTimedeltaArrayArithmetic(_DeprecationTestCase): | ||
| # Deprecation in NumPy 2.5, 2026-04 | ||
| message = "The 'generic' unit for NumPy timedelta is deprecated" |
Contributor
There was a problem hiding this comment.
It seems that it might be more consistent to add test methods into TestDeprecatedGenericTimedelta since the same deprecation message is raised.
Comment on lines
+460
to
+461
| if op == np.add: | ||
| self.assert_deprecated(op, num=None, args=(int_arr, timedelta_arr)) |
Contributor
There was a problem hiding this comment.
I think we need to test both add and subtract operations. It doesn't seem that this if statement is necessary.
c1acec4 to
956b6bc
Compare
Author
|
Hi @ngoldbaum |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR summary
Adds deprecation warning for arithmetic between integer arrays and timedelta64 arrays.
Same issue was found in datetime64, added deprecation there too. Happy to revert if out of scope.
Relates to #31255
First time committer introduction
Hi, was going through internals of numpy and saw the issue. Wanted to contribute and I'll be happy to receive feedback.
AI Disclosure
Took minimal help from Claude in writing test cases.