Skip to content

Commit

Permalink
Set atol in isclose in flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
dafeda committed Sep 12, 2023
1 parent fcfb7de commit a3a0907
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/unit_tests/config/test_transfer_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,20 @@ def test_that_truncated_normal_stays_within_bounds(x, arg):
assert arg[2] <= result <= arg[3]


# @reproduce_failure('6.83.0', b'AXicY2BABgfXM2ACRjQalckEAEqXAXY=')
@given(
st.floats(allow_nan=False, allow_infinity=False),
st.floats(allow_nan=False, allow_infinity=False),
valid_params(),
)
def test_that_truncated_normal_is_monotonic(x1, x2, arg):
arg = (0.0, 2.0, -1.0, 1.0)
x1 = 0.0
x2 = 7.450580596923853e-09
result1 = TransferFunction.trans_truncated_normal(x1, arg)
result2 = TransferFunction.trans_truncated_normal(x2, arg)

if np.isclose(x1, x2):
assert np.isclose(result1, result2)
assert np.isclose(result1, result2, atol=1e-7)
elif x1 < x2:
# Results should be different unless clamped
assert (
Expand Down

0 comments on commit a3a0907

Please sign in to comment.