Skip to content

TST: tests/core/test_multiarray:TestArg{Min,Max}: stray np.repeat #22891

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 1 commit into from
Dec 27, 2022

Conversation

ev-br
Copy link
Contributor

@ev-br ev-br commented Dec 26, 2022

Here's a test, which a.repeat(129) and discards the result, so that the output of the first and the third lines are identical:

>>> np.argmin(a)
>>> a.repeat(129)
>>> np.argmin(a)

The test was introduced in 762538c, a part of #20846.

So this PR makes an assumption that the intention of the test was to actually run argmin on a repeated array, and modifies the test accordingly.

The test does `a.repeat(129)` and discards the result:

>>> a.repeat(129)
>>> np.argmin(a)
@seberg
Copy link
Member

seberg commented Dec 26, 2022

Humm, I really thought we return the first occurance!? Does anyone remember, I guess this behavior now exists for the whole 1.23.x series in any case.

@WarrenWeckesser
Copy link
Member

WarrenWeckesser commented Dec 27, 2022

We do return the first occurrence. In the updated tests, the first occurrence of the extreme value in the original array is at index 1, so in the repeated array the first occurrence of the extreme value is at index 129.

@seberg seberg merged commit 8a0966e into numpy:main Dec 27, 2022
@seberg
Copy link
Member

seberg commented Dec 27, 2022

Right, was repeating the triplet instead of individual elements in my head. Thanks Evgeni.

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