summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_math.py
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2015-01-11 11:55:29 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2015-01-11 11:55:29 (GMT)
commita5d0c7c2fdd638d684acdb5391e0987b1e37f56a (patch)
tree90debcd5a43e635d8a0dda8cb69533588c6c513e /Lib/test/test_math.py
parent845b14cc8ef2d95e72c97a788a1ffb31faeaa3a8 (diff)
downloadcpython-a5d0c7c2fdd638d684acdb5391e0987b1e37f56a.zip
cpython-a5d0c7c2fdd638d684acdb5391e0987b1e37f56a.tar.gz
cpython-a5d0c7c2fdd638d684acdb5391e0987b1e37f56a.tar.bz2
Issue #23185: add math.inf and math.nan constants.
Diffstat (limited to 'Lib/test/test_math.py')
-rw-r--r--Lib/test/test_math.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py
index c9f3f16..023dea9 100644
--- a/Lib/test/test_math.py
+++ b/Lib/test/test_math.py
@@ -983,6 +983,17 @@ class MathTests(unittest.TestCase):
self.assertFalse(math.isinf(0.))
self.assertFalse(math.isinf(1.))
+ @requires_IEEE_754
+ def test_nan_constant(self):
+ self.assertTrue(math.isnan(math.nan))
+
+ @requires_IEEE_754
+ def test_inf_constant(self):
+ self.assertTrue(math.isinf(math.inf))
+ self.assertGreater(math.inf, 0.0)
+ self.assertEqual(math.inf, float("inf"))
+ self.assertEqual(-math.inf, float("-inf"))
+
# RED_FLAG 16-Oct-2000 Tim
# While 2.0 is more consistent about exceptions than previous releases, it
# still fails this part of the test on some platforms. For now, we only