Skip to content

Commit

Permalink
tests/isclose: Limit the range on absolute tolerance tests
Browse files Browse the repository at this point in the history
This removes a very-unlikely test failure, produced locally after running
Hypothesis almost a hundred times in CI profile.

This required pulling 24b206b from ppb#97.
  • Loading branch information
nbraud committed Jan 3, 2019
1 parent a4a9494 commit 3ce31b6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/test_vector2_isclose.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def test_isclose_to_self(x, abs_tol, rel_tol):

EPSILON = 1e-8

@given(x=vectors(), direction=units(), abs_tol=lengths())
@given(x=vectors(max_magnitude=1e30), direction=units(),
abs_tol=lengths(max_value=1e30))
def test_isclose_abs_error_pos(x, direction, abs_tol):
"""Test x.isclose(rel_tol=0) near the boundary between “close” and “not close”
Expand All @@ -23,7 +24,8 @@ def test_isclose_abs_error_pos(x, direction, abs_tol):
note(f"positive example: {positive} = x + {positive - x}")
assert x.isclose(positive, abs_tol=abs_tol, rel_tol=0)

@given(x=vectors(), direction=units(), abs_tol=lengths())
@given(x=vectors(max_magnitude=1e30), direction=units(),
abs_tol=lengths(max_value=1e30))
def test_isclose_abs_error_neg(x, direction, abs_tol):
"""Test x.isclose(rel_tol=0) near the boundary between “close” and “not close”
Expand Down

0 comments on commit 3ce31b6

Please sign in to comment.