Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/array_api_extra/_lib/_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ def _check_ns_shape_dtype(
if check_shape:
msg = f"shapes do not match: {actual_shape} != f{desired_shape}"
assert actual_shape == desired_shape, msg
else:
elif desired.ndim > 0:
# Ignore shape, but check flattened size. This is normally done by
# np.testing.assert_array_equal etc even when strict=False, but not for
# non-materializable arrays.
# This check excludes 0d arrays as they are special case in numpy.
Comment thread
lucascolley marked this conversation as resolved.
Outdated
actual_size = math.prod(actual_shape) # pyright: ignore[reportUnknownArgumentType]
desired_size = math.prod(desired_shape) # pyright: ignore[reportUnknownArgumentType]
msg = f"sizes do not match: {actual_size} != f{desired_size}"
Expand Down