Commit c105c1b8 authored by ento's avatar ento Committed by Jason Madden

Switch regression test to use sys.float_info

This one is available in older versions of Python
parent 0fc65d60
import math import sys
import unittest import unittest
from gevent.testing import PY39
class TestSubnormalFloatsAreNotDisabled(unittest.TestCase): class TestSubnormalFloatsAreNotDisabled(unittest.TestCase):
""" """
...@@ -10,11 +8,13 @@ class TestSubnormalFloatsAreNotDisabled(unittest.TestCase): ...@@ -10,11 +8,13 @@ class TestSubnormalFloatsAreNotDisabled(unittest.TestCase):
disabled the moment when gevent was imported. This impacted libraries disabled the moment when gevent was imported. This impacted libraries
that expect subnormal floats to be enabled. that expect subnormal floats to be enabled.
""" """
@unittest.skipUnless(PY39, "Need math.nextafter()")
def test_subnormal_is_not_zero(self): def test_subnormal_is_not_zero(self):
import gevent import gevent
assert math.nextafter(0, 1) != 0 # `sys.float_info.min` is the minimum representable positive normalized
# float, so dividing it by two gives us a positive subnormal float,
# as long as subnormals floats are not disabled.
assert (sys.float_info.min / 2) > 0
if __name__ == "__main__": if __name__ == "__main__":
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment