Skip to content

Commit d80641c

Browse files
committed
Handle inv in test_signatures correctly
It requires a different example argument that is invertible.
1 parent 62742fa commit d80641c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

array_api_tests/test_signatures.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import pytest
44

5-
from ._array_module import mod, mod_name, ones, float64
5+
from ._array_module import mod, mod_name, ones, eye, float64
66
from .pytest_helpers import raises, doesnt_raise
77

88
from . import function_stubs
@@ -73,10 +73,15 @@ def example_argument(arg, func_name):
7373
)
7474

7575
if arg in known_args:
76-
# This is the only special case. squeeze() requires an axis of size 1,
77-
# but other functions such as cross() require axes of size >1
76+
# Special cases:
77+
78+
# squeeze() requires an axis of size 1, but other functions such as
79+
# cross() require axes of size >1
7880
if func_name == 'squeeze' and arg == 'axis':
7981
return 0
82+
# ones() is not invertible
83+
elif func_name == 'inv' and arg == 'x':
84+
return eye(3)
8085
return known_args[arg]
8186
else:
8287
raise RuntimeError(f"Don't know how to test argument {arg}. Please update test_signatures.py")

0 commit comments

Comments
 (0)