Skip to content

Commit c3ad1e0

Browse files
committed
Make float assertions more lenient in statistical tests
1 parent 54561bc commit c3ad1e0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

array_api_tests/test_statistical_functions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def assert_equals(
9494
assert math.isnan(out), msg
9595
else:
9696
msg = f"{out_repr}={out}, should be roughly {expected} [{f_func}]"
97-
assert math.isclose(out, expected, rel_tol=0.05), msg
97+
assert math.isclose(out, expected, rel_tol=0.25, abs_tol=1), msg
9898

9999

100100
@given(
@@ -175,6 +175,7 @@ def test_mean(x, data):
175175
)
176176
for indices, out_idx in zip(axes_ndindex(x.shape, _axes), ah.ndindex(out.shape)):
177177
mean = float(out[out_idx])
178+
assume(not math.isinf(mean)) # mean may become inf due to internal overflows
178179
elements = []
179180
for idx in indices:
180181
s = float(x[idx])

0 commit comments

Comments
 (0)