Skip to content

Commit dd7c6a3

Browse files
committed
fix tolerance tests
1 parent a656ada commit dd7c6a3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

netcompare/check_types.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ def _remove_within_tolerance(self, diff: Dict, tolerance: int) -> None:
149149

150150
def _within_tolerance(*, old_value: float, new_value: float) -> bool:
151151
"""Return True if new value is within the tolerance range of the previous value."""
152-
max_diff = old_value * tolerance
152+
tolerance_factor = tolerance / 100
153+
max_diff = old_value * tolerance_factor
153154
return (old_value - max_diff) < new_value < (old_value + max_diff)
154155

155156
for key, value in list(diff.items()): # casting list makes copy, so we don't modify object being iterated.

0 commit comments

Comments
 (0)