We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1f9d890 commit 2153302Copy full SHA for 2153302
Lib/test/test_math_property.py
@@ -8,10 +8,8 @@
8
integers = hypothesis.strategies.integers
9
10
11
-def equal_float(x, y):
12
- if isnan(x) and isnan(y):
13
- return True
14
- assert x == y
+def assert_equal_float(x, y):
+ assert isnan(x) and isnan(y) or x == y
15
16
17
def via_reduce(x, y, steps):
@@ -25,8 +23,8 @@ class NextafterTests(unittest.TestCase):
25
23
y=floats(),
26
24
steps=integers(min_value=0, max_value=2**16))
27
def test_count(self, x, y, steps):
28
- equal_float(via_reduce(x, y, steps),
29
- nextafter(x, y, steps=steps))
+ assert_equal_float(via_reduce(x, y, steps),
+ nextafter(x, y, steps=steps))
30
31
@requires_IEEE_754
32
@hypothesis.given(
@@ -40,4 +38,4 @@ def test_addition_commutes(self, x, y, a, b):
40
38
combined = nextafter(x, y, steps=a+b)
41
39
hypothesis.note(f"{first} -> {second} == {combined}")
42
43
- equal_float(second, combined)
+ assert_equal_float(second, combined)
0 commit comments