mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Issue #9165: Add math.isfinite and cmath.isfinite.
This commit is contained in:
parent
3e7428995f
commit
8e0c996873
7 changed files with 61 additions and 0 deletions
|
@ -915,6 +915,15 @@ class MathTests(unittest.TestCase):
|
|||
self.assertRaises(TypeError, math.trunc, 1, 2)
|
||||
self.assertRaises(TypeError, math.trunc, TestNoTrunc())
|
||||
|
||||
def testIsfinite(self):
|
||||
self.assertTrue(math.isfinite(0.0))
|
||||
self.assertTrue(math.isfinite(-0.0))
|
||||
self.assertTrue(math.isfinite(1.0))
|
||||
self.assertTrue(math.isfinite(-1.0))
|
||||
self.assertFalse(math.isfinite(float("nan")))
|
||||
self.assertFalse(math.isfinite(float("inf")))
|
||||
self.assertFalse(math.isfinite(float("-inf")))
|
||||
|
||||
def testIsnan(self):
|
||||
self.assertTrue(math.isnan(float("nan")))
|
||||
self.assertTrue(math.isnan(float("inf")* 0.))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue