Skip to content
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: ensure np.equal.reduce raises a TypeError #22223

Merged
merged 2 commits into from Sep 7, 2022

Conversation

charris
Copy link
Member

@charris charris commented Sep 7, 2022

Backport of #21981.

Closes #20929

Added a couple of tests to ensure that np.equal.reduce raises TypeError, and the developers are notified if the API changes.

I am not very sure if I should be creating a new method for this test. Please let me know if I can add the tests in any existing method.

Thanks!

Saransh-cpp and others added 2 commits September 7, 2022 11:17
If we cache a promoted version of the loop, that promoted can mismatch
the correct one.  This ends up being rejected later in the legacy paths
(should be the only path currently used), but we should reject it here
(or in principle we could reject it after cache lookup, but we are fixing
up the operation DTypes here anyway, so we are looking at the signature).

A call sequence reproducing this directly is:

np.add(1, 2, signature=(bool, int, None))  # should fail

np.add(True, 2)  # A promoted loop
np.add(1, 2, signature=(bool, int, None))  # should still fail

Not that the errors differ, because the first one comes from the old
type resolution code and is currently less precise
@charris charris added 00 - Bug 05 - Testing 08 - Backport Used to tag backport PRs labels Sep 7, 2022
@charris charris added this to the 1.23.3 release milestone Sep 7, 2022
@charris charris merged commit 55a5ca7 into numpy:maintenance/1.23.x Sep 7, 2022
@charris charris deleted the backport-21981 branch September 7, 2022 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants