Skip to content

Commit bc362a3

Browse files
committed
address review
1 parent f6a55ce commit bc362a3

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

Lib/test/test_math.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
eps = 1E-05
1919
NAN = float('nan')
20-
NNAN = float('-nan')
2120
INF = float('inf')
2221
NINF = float('-inf')
2322
FLOAT_MAX = sys.float_info.max
@@ -480,12 +479,14 @@ def test_signbit(self):
480479
self.assertRaises(TypeError, math.signbit)
481480
self.assertRaises(TypeError, math.signbit, '1.0')
482481

483-
for arg in [0, 0., 1, 1., INF, NAN]:
484-
with self.subTest('positive', arg=arg):
485-
self.assertFalse(math.signbit(arg))
486-
for arg in [-0., -1, -1., NINF, NNAN]:
487-
with self.subTest('negative', arg=arg):
488-
self.assertTrue(math.signbit(arg))
482+
# C11, §7.12.3.6 requires signbit() to return a nonzero value
483+
# if and only if the sign of its argument value is negative,
484+
# but in practice, we are only interested in a boolean value.
485+
self.assertIsInstance(math.signbit(1.0), bool)
486+
487+
for arg in [0., 1., INF, NAN]:
488+
self.assertFalse(math.signbit(arg))
489+
self.assertTrue(math.signbit(-arg))
489490

490491
def testCos(self):
491492
self.assertRaises(TypeError, math.cos)

0 commit comments

Comments
 (0)