Skip to content

Commit

Permalink
tests/isclose: Loosen the precision on the absolute tolerance test
Browse files Browse the repository at this point in the history
  • Loading branch information
nbraud committed Jan 2, 2019
1 parent 3675d77 commit 8863032
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/test_vector2_isclose.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ def test_isclose_to_self(x, abs_tol, rel_tol):
assert x.isclose(x, abs_tol=abs_tol, rel_tol=rel_tol)


EPSILON = 1e-8

@given(x=vectors(), direction=units(), abs_tol=lengths())
def test_isclose_abs_error(x, direction, abs_tol):
"""Test x.isclose(rel_tol=0) near the boundary between “close” and “not close”
Expand All @@ -21,7 +23,6 @@ def test_isclose_abs_error(x, direction, abs_tol):
error = abs_tol * direction
note(f"error = {error}")

EPSILON = 1e-12
positive = x + (1 - EPSILON) * error
note(f"positive example: {positive} = x + {positive - x}")
assert x.isclose(positive, abs_tol=abs_tol, rel_tol=0)
Expand All @@ -33,7 +34,6 @@ def test_isclose_abs_error(x, direction, abs_tol):
assert not x.isclose(negative, abs_tol=abs_tol, rel_tol=0)


EPSILON = 1e-8
@given(x=vectors(), direction=units(),
rel_tol=floats(min_value=EPSILON, max_value=1-EPSILON))
def test_isclose_rel_error(x, direction, rel_tol):
Expand Down

0 comments on commit 8863032

Please sign in to comment.