Skip to content

Commit 351892c

Browse files
committed
Skip testing undefined default uints for test_sum
1 parent e3a0722 commit 351892c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

array_api_tests/test_statistical_functions.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,15 @@ def test_sum(x, data):
248248
_dtype = dh.default_float
249249
else:
250250
_dtype = dtype
251-
ph.assert_dtype("sum", x.dtype, out.dtype, _dtype)
251+
if isinstance(_dtype, _UndefinedStub):
252+
# If a default uint cannot exist (i.e. in PyTorch which doesn't support
253+
# uint32 or uint64), we skip testing the output dtype.
254+
# See https://github.com/data-apis/array-api-tests/issues/160
255+
if _dtype in dh.uint_dtypes:
256+
assert dh.is_int_dtype(out.dtype) # sanity check
257+
else:
258+
ph.assert_dtype("sum", x.dtype, out.dtype, _dtype)
259+
252260
_axes = sh.normalise_axis(kw.get("axis", None), x.ndim)
253261
ph.assert_keepdimable_shape(
254262
"sum", x.shape, out.shape, _axes, kw.get("keepdims", False), **kw

0 commit comments

Comments
 (0)