Skip to content

Commit 11085e7

Browse files
committed
Use constant for SIGNALING_NAN
1 parent 296af5b commit 11085e7

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

hypothesis-python/tests/conjecture/test_float_encoding.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
# obtain one at https://mozilla.org/MPL/2.0/.
1010

1111
import math
12-
import struct
1312
import sys
1413

1514
import pytest
@@ -18,7 +17,7 @@
1817
from hypothesis.internal.compat import ceil, extract_bits, floor
1918
from hypothesis.internal.conjecture import floats as flt
2019
from hypothesis.internal.conjecture.engine import ConjectureRunner
21-
from hypothesis.internal.floats import float_to_int
20+
from hypothesis.internal.floats import SIGNALING_NAN, float_to_int
2221

2322
EXPONENTS = list(range(flt.MAX_EXPONENT + 1))
2423
assert len(EXPONENTS) == 2**11
@@ -204,9 +203,7 @@ def test_reject_out_of_bounds_floats_while_shrinking():
204203
assert g == 103.0
205204

206205

207-
@pytest.mark.parametrize(
208-
"nan", [-math.nan, struct.unpack("d", struct.pack("Q", 0xFFF8000000000001))[0]]
209-
)
206+
@pytest.mark.parametrize("nan", [-math.nan, SIGNALING_NAN, -SIGNALING_NAN])
210207
def test_shrinks_to_canonical_nan(nan):
211208
shrunk = minimal_from(nan, math.isnan)
212209
assert float_to_int(shrunk) == float_to_int(math.nan)

0 commit comments

Comments
 (0)