Skip to content

Commit 80d2909

Browse files
committed
Skip when refimpl overflows
1 parent 7386615 commit 80d2909

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

array_api_tests/test_operators_and_elementwise_functions.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ def unary_assert_against_refimpl(
7979
scalar_i = in_stype(in_[idx])
8080
if not filter_(scalar_i):
8181
continue
82-
expected = refimpl(scalar_i)
82+
try:
83+
expected = refimpl(scalar_i)
84+
except OverflowError:
85+
continue
8386
if res.dtype != xp.bool:
8487
assert m is not None and M is not None # for mypy
8588
if expected <= m or expected >= M:
@@ -122,7 +125,10 @@ def binary_assert_against_refimpl(
122125
scalar_r = in_stype(right[r_idx])
123126
if not (filter_(scalar_l) and filter_(scalar_r)):
124127
continue
125-
expected = refimpl(scalar_l, scalar_r)
128+
try:
129+
expected = refimpl(scalar_l, scalar_r)
130+
except OverflowError:
131+
continue
126132
if res.dtype != xp.bool:
127133
assert m is not None and M is not None # for mypy
128134
if expected <= m or expected >= M:
@@ -359,7 +365,10 @@ def binary_param_assert_against_refimpl(
359365
scalar_l = in_stype(left[idx])
360366
if not filter_(scalar_l):
361367
continue
362-
expected = refimpl(scalar_l, right)
368+
try:
369+
expected = refimpl(scalar_l, right)
370+
except OverflowError:
371+
continue
363372
if left.dtype != xp.bool:
364373
assert m is not None and M is not None # for mypy
365374
if expected <= m or expected >= M:

0 commit comments

Comments
 (0)