Skip to content

Commit fedd418

Browse files
committed
Sanity check out dtype when expected is undefined for test_prod
1 parent 351892c commit fedd418

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

array_api_tests/test_statistical_functions.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,13 @@ def test_prod(x, data):
147147
_dtype = dh.default_float
148148
else:
149149
_dtype = dtype
150-
# We ignore asserting the out dtype if what we expect is undefined
151-
# See https://github.com/data-apis/array-api-tests/issues/106
152-
if not isinstance(_dtype, _UndefinedStub):
150+
if isinstance(_dtype, _UndefinedStub):
151+
# If a default uint cannot exist (i.e. in PyTorch which doesn't support
152+
# uint32 or uint64), we skip testing the output dtype.
153+
# See https://github.com/data-apis/array-api-tests/issues/106
154+
if _dtype in dh.uint_dtypes:
155+
assert dh.is_int_dtype(out.dtype) # sanity check
156+
else:
153157
ph.assert_dtype("prod", x.dtype, out.dtype, _dtype)
154158
_axes = sh.normalise_axis(kw.get("axis", None), x.ndim)
155159
ph.assert_keepdimable_shape(

0 commit comments

Comments
 (0)