Skip to content

TST: cover reflected scalar operators - #471

Open
Boulea7 wants to merge 3 commits into
data-apis:masterfrom
Boulea7:test/reflected-scalar-operators-460
Open

Boulea7 wants to merge 3 commits into
data-apis:masterfrom
Boulea7:test/reflected-scalar-operators-460

Conversation

@Boulea7

@Boulea7 Boulea7 commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

The operator tests exercise array-left expressions but do not check scalar-left reflected arithmetic and bitwise operators. This adds Hypothesis-generated cases for the seven reflected arithmetic methods and five reflected bitwise methods, checking dtype, shape, and values against the corresponding Array API functions. Inputs stay small and finite, with nonzero divisors, small whole-number exponents, and valid shift counts.

The parametrized cases are materialized as a list so collection does not rely on pytest's deprecated support for generator arguments.

Validation: 115 reflected-operator cases pass with array-api-strict 2.6.1 (API 2025.12) and pytest 9.1.1, with PytestRemovedIn10Warning treated as an error. The full suite was not run locally.

Refs #460

Copilot AI lite review requested due to automatic review settings September 28, 2026 09:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

("__ror__", "bitwise_or", operator.or_, dh.bool_and_all_int_dtypes, 6, (1, 2)),
("__rxor__", "bitwise_xor", operator.xor, dh.bool_and_all_int_dtypes, 6, (1, 2)),
("__rlshift__", "bitwise_left_shift", operator.lshift, dh.all_int_dtypes, 3, (1, 2)),
("__rrshift__", "bitwise_right_shift", operator.rshift, dh.all_int_dtypes, 8, (1, 2)),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For consistency with the rest of the test suite, it'd be better to use hypothesis-generated values.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The tests now draw scalars, array elements, and shapes with Hypothesis; the focused cases pass locally with array-api-strict and NumPy.

This branch has not been deployed

No deployments
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.

3 participants