Skip to content

Commit a054d53

Browse files
committed
Better error message for missing array attributes that aren't methods
1 parent 46aa91d commit a054d53

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

array_api_tests/test_signatures.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ def example_argument(arg, func_name):
9191
def test_has_names(name):
9292
if array_method(name):
9393
arr = ones((1,))
94-
assert hasattr(arr, name), f"The array object is missing the method {name}()"
94+
if getattr(function_stubs.array_object, name) is None:
95+
assert hasattr(arr, name), f"The array object is missing the attribute {name}"
96+
else:
97+
assert hasattr(arr, name), f"The array object is missing the method {name}()"
9598
else:
9699
assert hasattr(mod, name), f"{mod_name} is missing the {function_category(name)} function {name}()"
97100

0 commit comments

Comments
 (0)