We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5045afa commit 7bc51a1Copy full SHA for 7bc51a1
1 file changed
src/array_api_extra/_lib/_testing.py
@@ -77,10 +77,11 @@ def _check_ns_shape_dtype(
77
if check_shape:
78
msg = f"shapes do not match: {actual_shape} != f{desired_shape}"
79
assert actual_shape == desired_shape, msg
80
- else:
+ elif desired.ndim > 0:
81
# Ignore shape, but check flattened size. This is normally done by
82
# np.testing.assert_array_equal etc even when strict=False, but not for
83
# non-materializable arrays.
84
+ # This check excludes 0d arrays as they are special case in numpy.
85
actual_size = math.prod(actual_shape) # pyright: ignore[reportUnknownArgumentType]
86
desired_size = math.prod(desired_shape) # pyright: ignore[reportUnknownArgumentType]
87
msg = f"sizes do not match: {actual_size} != f{desired_size}"
0 commit comments