Skip to content

Commit

Permalink
fix(tests): test for almost equality to prevent floating point errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rubik committed Sep 19, 2019
1 parent 7c51a6f commit f59f912
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions radon/tests/test_other_metrics.py
Expand Up @@ -66,8 +66,9 @@ def f(b):
@pytest.mark.parametrize('code,expected', H_VISIT_CASES)
def test_h_visit(code, expected):
code = dedent(code)
expected = expected
assert h_visit(code) == expected
# test for almost-equality
for act, exp in zip(h_visit(code), expected):
assert act == exp or int(act * 10**3) == int(exp * 10**3)


first_mi = '''
Expand Down

0 comments on commit f59f912

Please sign in to comment.