Skip to content

Commit 9efcad5

Browse files
committed
Don't ignore exceptions in elementwise reference implementations
For some reason, "except OverflowError" was changed to "except Exception" in e72184e. For now I have removed the except entirely, but it's possible we may need to keep the handling for OverflowError. There are several issues with tests that this was masking, which I have not fixed yet. Quite a few tests are not testing the complex implementations correctly because they are using math instead of cmath, for example. See also data-apis/array-api-compat#183.
1 parent 635843d commit 9efcad5

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

Diff for: array_api_tests/test_operators_and_elementwise_functions.py

+3-12
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,7 @@ def unary_assert_against_refimpl(
242242
scalar_i = in_stype(in_[idx])
243243
if not filter_(scalar_i):
244244
continue
245-
try:
246-
expected = refimpl(scalar_i)
247-
except Exception:
248-
continue
245+
expected = refimpl(scalar_i)
249246
if res.dtype != xp.bool:
250247
if res.dtype in dh.complex_dtypes:
251248
if expected.real <= m or expected.real >= M:
@@ -317,10 +314,7 @@ def binary_assert_against_refimpl(
317314
scalar_r = in_stype(right[r_idx])
318315
if not (filter_(scalar_l) and filter_(scalar_r)):
319316
continue
320-
try:
321-
expected = refimpl(scalar_l, scalar_r)
322-
except Exception:
323-
continue
317+
expected = refimpl(scalar_l, scalar_r)
324318
if res.dtype != xp.bool:
325319
if res.dtype in dh.complex_dtypes:
326320
if expected.real <= m or expected.real >= M:
@@ -392,10 +386,7 @@ def right_scalar_assert_against_refimpl(
392386
scalar_l = in_stype(left[idx])
393387
if not (filter_(scalar_l) and filter_(right)):
394388
continue
395-
try:
396-
expected = refimpl(scalar_l, right)
397-
except Exception:
398-
continue
389+
expected = refimpl(scalar_l, right)
399390
if left.dtype != xp.bool:
400391
if res.dtype in dh.complex_dtypes:
401392
if expected.real <= m or expected.real >= M:

0 commit comments

Comments
 (0)