Skip to content

🐛 fix failing abstract number binop type-tests #448

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

Merged
merged 7 commits into from
Mar 31, 2025

Conversation

jorenham
Copy link
Member

@jorenham jorenham commented Mar 31, 2025

This backwards incompatible with NumPy, because this removes the type-unsafe number.__[r]floordiv__ dunder methods.

This additionally fixes the scalar-binop testgen script, so that stops skipping the generation of all timedelta and datetime rejectection tests.
It now also generates way less trivial rejection tests for the bitwise and modular operators.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses failing abstract binop type-tests by removing the type-unsafe dunder methods from numpy.number and by enhancing the test generation for scalar binary operations.

  • Updates operator mappings from symbols to descriptive names for datetime, timedelta, and bitwise operations.
  • Adjusts filtering logic in scalar test generation for both built-in and abstract types.
  • Updates documentation to reflect the removal of number floordiv methods and fixes a spelling error.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

File Description
tool/testgen.py Improves operator mappings, name filtering, and rejection logic in scalar binary operation test generation.
docs/user_guide/differences.md Updates documentation to correctly describe the removal of certain operations and fixes a spelling error.
Comments suppressed due to low confidence (2)

tool/testgen.py:671

  • [nitpick] Consider replacing the magic string set for rejection with a named constant to improve code clarity and maintainability.
            reject |= {"bhilBHILefdgFDG", "FDG", "F", "D", "G"}

tool/testgen.py:675

  • [nitpick] Using set("FGM") may be unclear; consider using a descriptive constant or a more explicit data structure to document the intent behind these ignored types.
            ignore |= set("FGM")

@jorenham jorenham merged commit efdf53a into main Mar 31, 2025
24 checks passed
@jorenham jorenham deleted the testgen-number-binops branch March 31, 2025 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant