Repository navigation
Description
Several tests for NumPy dev fail. What's concerning is that these don't seem to show up on CI, despite the CI apparently running the latest version of the test suite and installing the latest version of NumPy. See for instance https://github.com/data-apis/array-api-compat/actions/runs/10149966468/job/28066028900, which is definitely installing the right version of the test suite https://github.com/data-apis/array-api-compat/actions/runs/10149966468/job/28066028900#step:3:101, and definitely testing against numpy 2.1.0-dev https://github.com/data-apis/array-api-compat/actions/runs/10149966468/job/28066028900#step:7:24
FAILED array_api_tests/test_operators_and_elementwise_functions.py::test_clip - AssertionError: out.dtype=int64, but should be uint32 [clip(uint32)]
Falsifying example: test_clip(
x=array([65535, 35892, 35892, 35892, 35892], dtype=uint32),
data=data(...),
)
Draw 1 (min.shape, max.shape): ((), ())
Draw 2 (min): None
Draw 3 (max): array(0, dtype=int8)
Draw 4 (kwargs): {'max': array(0, dtype=int8)}
FAILED array_api_tests/test_set_functions.py::test_unique_inverse - TypeError: Input should be a NumPy array. It is a <class 'numpy.bool'> instead.
Falsifying example: test_unique_inverse(
x=array(0., dtype=float32),
)
Explanation:
These lines were always and only run by failing examples:
/Users/aaronmeurer/Documents/array-api-tests/array_api_tests/dtype_helpers.py:187
/Users/aaronmeurer/Documents/array-api-tests/array_api_tests/hypothesis_helpers.py:38
/Users/aaronmeurer/Documents/array-api-tests/array_api_tests/hypothesis_helpers.py:45
/Users/aaronmeurer/Documents/numpy/numpy/_core/getlimits.py:491
FAILED array_api_tests/test_set_functions.py::test_unique_values - TypeError: Input should be a NumPy array. It is a <class 'numpy.bool'> instead.
Falsifying example: test_unique_values(
x=array(0., dtype=float32),
)
Explanation:
These lines were always and only run by failing examples:
/Users/aaronmeurer/Documents/array-api-tests/array_api_tests/dtype_helpers.py:187
/Users/aaronmeurer/Documents/array-api-tests/array_api_tests/hypothesis_helpers.py:38
/Users/aaronmeurer/Documents/array-api-tests/array_api_tests/hypothesis_helpers.py:45
/Users/aaronmeurer/Documents/numpy/numpy/_core/getlimits.py:491
FAILED array_api_tests/test_signatures.py::test_func_signature[argsort] - AssertionError: Argument 'descending' missing from signature
assert 'descending' in odict_keys(['a', 'axis', 'kind', 'order', 'stable'])
+ where 'descending' = <Parameter "descending: bool = False">.name
+ and odict_keys(['a', 'axis', 'kind', 'order', 'stable']) = <built-in method keys of mappingproxy object at 0x11b70e0b0>()
+ where <built-in method keys of mappingproxy object at 0x11b70e0b0> = mappingproxy(OrderedDict({'a': <Parameter "a">, 'axis': <Parameter "axis=-1">, 'kind': <Parameter "kind=None">, 'order': <Parameter "order=None">, 'stable': <Parameter "stable=None">})).keys
+ where mappingproxy(OrderedDict({'a': <Parameter "a">, 'axis': <Parameter "axis=-1">, 'kind': <Parameter "kind=None">, 'order': <Parameter "order=None">, 'stable': <Parameter "stable=None">})) = <Signature (a, axis=-1, kind=None, order=None, *, stable=None)>.parameters
FAILED array_api_tests/test_signatures.py::test_func_signature[sort] - AssertionError: Argument 'descending' missing from signature
assert 'descending' in odict_keys(['a', 'axis', 'kind', 'order', 'stable'])
+ where 'descending' = <Parameter "descending: bool = False">.name
+ and odict_keys(['a', 'axis', 'kind', 'order', 'stable']) = <built-in method keys of mappingproxy object at 0x11ae295d0>()
+ where <built-in method keys of mappingproxy object at 0x11ae295d0> = mappingproxy(OrderedDict({'a': <Parameter "a">, 'axis': <Parameter "axis=-1">, 'kind': <Parameter "kind=None">, 'order': <Parameter "order=None">, 'stable': <Parameter "stable=None">})).keys
+ where mappingproxy(OrderedDict({'a': <Parameter "a">, 'axis': <Parameter "axis=-1">, 'kind': <Parameter "kind=None">, 'order': <Parameter "order=None">, 'stable': <Parameter "stable=None">})) = <Signature (a, axis=-1, kind=None, order=None, *, stable=None)>.parameters
FAILED array_api_tests/test_signatures.py::test_func_signature[clip] - AssertionError: Expected argument 'a_min' to be named 'min'
assert 'a_min' == 'min'
- min
+ a_min
? ++
FAILED array_api_tests/test_sorting_functions.py::test_argsort - TypeError: argsort() got an unexpected keyword argument 'descending'
Falsifying example: test_argsort(
x=array([0], dtype=uint8), # or any other generated value
data=data(...),
)
Draw 1 (kw): {'descending': False}
FAILED array_api_tests/test_sorting_functions.py::test_sort - TypeError: sort() got an unexpected keyword argument 'descending'
Falsifying example: test_sort(
x=array([15, 15, 15, 15], dtype=uint8),
data=data(...),
)
Draw 1 (kw): {'descending': False}
Activity
asmeurer commentedon Jul 30, 2024
Right, it's testing the compat layer, because the CI just tests the module directly, so it's unrelated to the
array_namespacelogic that skips the compat layer. We need to just get rid of that logic for NumPy, since 2.0 and 2.1 both do have some incompatibilities. We could lighten the wrapping for 2.0 so that unnecessary things aren't wrapped, although I don't know if that complexity is worth it. The main benefit would be performance. I guess we should see if there is a meaningful difference.asmeurer commentedon Jul 30, 2024
These tests all pass against the wrapped namespace, so these test failures are an issue for upstream NumPy (or in the case of some of them, the test suite).
Re-enable wrapping unconditionally for NumPy