Skip to content

Commit 2153302

Browse files
simplify
1 parent 1f9d890 commit 2153302

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Lib/test/test_math_property.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88
integers = hypothesis.strategies.integers
99

1010

11-
def equal_float(x, y):
12-
if isnan(x) and isnan(y):
13-
return True
14-
assert x == y
11+
def assert_equal_float(x, y):
12+
assert isnan(x) and isnan(y) or x == y
1513

1614

1715
def via_reduce(x, y, steps):
@@ -25,8 +23,8 @@ class NextafterTests(unittest.TestCase):
2523
y=floats(),
2624
steps=integers(min_value=0, max_value=2**16))
2725
def test_count(self, x, y, steps):
28-
equal_float(via_reduce(x, y, steps),
29-
nextafter(x, y, steps=steps))
26+
assert_equal_float(via_reduce(x, y, steps),
27+
nextafter(x, y, steps=steps))
3028

3129
@requires_IEEE_754
3230
@hypothesis.given(
@@ -40,4 +38,4 @@ def test_addition_commutes(self, x, y, a, b):
4038
combined = nextafter(x, y, steps=a+b)
4139
hypothesis.note(f"{first} -> {second} == {combined}")
4240

43-
equal_float(second, combined)
41+
assert_equal_float(second, combined)

0 commit comments

Comments
 (0)