Skip to content

✅ Add type tests covering all relevant datetime64 and timedelta64#859

Merged
jorenham merged 4 commits intonumpy:mainfrom
Aniketsy:fix-417
Apr 21, 2026
Merged

✅ Add type tests covering all relevant datetime64 and timedelta64#859
jorenham merged 4 commits intonumpy:mainfrom
Aniketsy:fix-417

Conversation

@Aniketsy
Copy link
Copy Markdown
Contributor

towards #417

tests includes :-

  • datetime + timedelta
  • datetime - timedelta
  • datetime - datetime
  • timedelta + timedelta
  • timedelta - timedelta
  • timedelta / timedelta
  • timedelta % timedelta
  • timedelta * int, / int, and reverse multiply ( i added this as per suggestion from llm)

please let me know if we need improvements in this or i've missed any test coverage .. ThankYou 😊

@Aniketsy
Copy link
Copy Markdown
Contributor Author

converting in draft, i'll fix these ci-failures.

@Aniketsy Aniketsy marked this pull request as draft April 20, 2026 17:02
@Aniketsy
Copy link
Copy Markdown
Contributor Author

#95 just saw this, i guess this could be the reason for ci-failure

for these tests as per my understanding we can add # type: ignore[assert-type] , but i think we can fix this issue @jorenham gentle-ping, please let me know if you have any pointers, i'll open PR for this issue shortly maybe (till mid-night 😁)

@jorenham
Copy link
Copy Markdown
Member

please let me know if you have any pointers, i'll open PR for this issue shortly maybe (till mid-night 😁)

Fixing #95 is probably more difficult that you might think. You're of course welcome to try; but it can be pretty tricky to deal get all the type-checkers on the same page when dealing with Any.
If I remember correctly, I've already made this change in NumPy, but, numpy and numtype have very different ways of dealing with type promotions, so it wouldn't be a 1-to-1 translation.

@Aniketsy
Copy link
Copy Markdown
Contributor Author

please let me know if you have any pointers, i'll open PR for this issue shortly maybe (till mid-night 😁)

Fixing #95 is probably more difficult that you might think. You're of course welcome to try; but it can be pretty tricky to deal get all the type-checkers on the same page when dealing with Any. If I remember correctly, I've already made this change in NumPy, but, numpy and numtype have very different ways of dealing with type promotions, so it wouldn't be a 1-to-1 translation.

thanks, i thought it would be simple, but as you mentioned its probably more difficult, i can give it try and reach out to you if i stuck or have any query, if that's fine ..

Copy link
Copy Markdown
Member

@jorenham jorenham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add a brief comment explaining why we need these type igores

@Aniketsy
Copy link
Copy Markdown
Contributor Author

let's add a brief comment explaining why we need these type igores

sure 👍

@Aniketsy Aniketsy marked this pull request as ready for review April 21, 2026 11:04
Comment thread src/numpy-stubs/@test/static/accept/temporal_scalar_ops.pyi Outdated
@jorenham jorenham changed the title Add type tests covering all relevant datetime64 and timedelta64 ✅ Add type tests covering all relevant datetime64 and timedelta64 Apr 21, 2026
@jorenham jorenham merged commit 8fd2b40 into numpy:main Apr 21, 2026
21 checks passed
@jorenham
Copy link
Copy Markdown
Member

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants