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: Move new asarray test to a more appropriate place. #22251

Merged
merged 3 commits into from Sep 13, 2022

Conversation

eirrgang
Copy link
Contributor

As noted at #21995 (comment), the new test from #21995 was placed in a directory intended for the Array API, and unrelated to the change.

The test would not be out of place in test_multiarray.py, but I was urged not to contribute to the bloat of that file. It does seem appropriate to put the new test in the same directory as test_multiarray.py, though.

Refs #1468

@eirrgang
Copy link
Contributor Author

From #21995 (comment), @seberg writes

Way too long, but test_multiarray.py with TestCreation might be an option. Otherwise test_array_coercion.py has somewhat related tests so you could just add it in that file. The only real problem here is that it doesn't belong under array_api/tests, but core/tests

@eirrgang
Copy link
Contributor Author

... test_array_coercion.py has somewhat related tests so you could just add it in that file.

If you think test_array_coercion.py is appropriate, that looks like the best fit to me.

Will do.

Remove `test_asarray.py`. Create a new `TestAsArray` suite in
`test_array_coercion.py`
Wrap some comments that got too long after function became
a method (with additional indentation).
@seberg
Copy link
Member

seberg commented Sep 13, 2022

Interesting, the windows RuntimeWarning heisenbug seems to be affecting the Linux 32bit full-with-asserts runner here:

_________________ TestMatmulOperator.test_vector_matrix_values _________________

self = <numpy.core.tests.test_multiarray.TestMatmulOperator object at 0xe7991bc8>

    def test_vector_matrix_values(self):
        vec = np.array([1, 2])
        mat1 = np.array([[1, 2], [3, 4]])
        mat2 = np.stack([mat1]*2, axis=0)
        tgt1 = np.array([7, 10])
        tgt2 = np.stack([tgt1]*2, axis=0)
        for dt in self.types[1:]:
            v = vec.astype(dt)
            m1 = mat1.astype(dt)
            m2 = mat2.astype(dt)
>           res = self.matmul(v, m1)
E           RuntimeWarning: invalid value encountered in matmul

Not a worry for this, but might be interesting and make debugging easier, eventually?

Thanks @eirrgang, somehow I thought I had a closer look at this during SciPy already... Could in principle split up the test into smaller ones, but it doesn't matter much and the test looks very thorough.

@seberg seberg merged commit 4d4fca0 into numpy:main Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Second contribution
Development

Successfully merging this pull request may close these issues.

None yet

2 participants