8000 gh-123811: test that round() can return signed zero (#123829) · python/cpython@d2b9b6f · GitHub
[go: up one dir, main page]

Skip to content

Commit d2b9b6f

Browse files
authored
gh-123811: test that round() can return signed zero (#123829)
1 parent a1dbf2e commit d2b9b6f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Lib/test/test_float.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ def test_short_repr(self):
863863
self.assertEqual(repr(float(negs)), str(float(negs)))
864864

865865
@support.requires_IEEE_754
866-
class RoundTestCase(unittest.TestCase):
866+
class RoundTestCase(unittest.TestCase, FloatsAreIdenticalMixin):
867867

868868
def test_inf_nan(self):
869869
self.assertRaises(OverflowError, round, INF)
@@ -893,10 +893,10 @@ def test_large_n(self):
893893

894894
def test_small_n(self):
895895
for n in [-308, -309, -400, 1-2**31, -2**31, -2**31-1, -2**100]:
896-
self.assertEqual(round(123.456, n), 0.0)
897-
self.assertEqual(round(-123.456, n), -0.0)
898-
self.assertEqual(round(1e300, n), 0.0)
899-
self.assertEqual(round(1e-320, n), 0.0)
896+
self.assertFloatsAreIdentical(round(123.456, n), 0.0)
897+
self.assertFloatsAreIdentical(round(-123.456, n), -0.0)
898+
self.assertFloatsAreIdentical(round(1e300, n), 0.0)
899+
self.assertFloatsAreIdentical(round(1e-320, n), 0.0)
900900

901901
def test_overflow(self):
902902
self.assertRaises(OverflowError, round, 1.6e308, -308)

0 commit comments

Comments
 (0)
0