data-apis / array-api-tests

Test suite for the PyData Array APIs standard
https://data-apis.org/array-api-tests/
MIT License
64 stars 41 forks source link

test_nonzero in test_searching_functions.py incorrectly handle 0d inputs #194

Open oleksandr-pavlyk opened 1 year ago

oleksandr-pavlyk commented 1 year ago

xp.nonzero is documented in the spec to require an exception for 0d arrays:

x (array) – input array. Must have a positive rank. If x is zero-dimensional, the function must raise an exception.

Yet the code exercises xp.nonzero for zero-dimensional arrays and expects the function to returns a tuple of size 1: https://github.com/data-apis/array-api-tests/blob/f82c7bc8627cc2c3a44fa3e425f53a253a609aa8/array_api_tests/test_searching_functions.py#L93-L98

This discrepancy should be fixed, or the spec modified.