Skip to content

Commit 8ca75ee

Browse files
miss-islingtonskirpichevvstinner
authored
[3.12] gh-123811: test that round() can return signed zero (GH-123829) (#123939)
gh-123811: test that round() can return signed zero (GH-123829) (cherry picked from commit d2b9b6f) Co-authored-by: Sergey B Kirpichev <[email protected]> Co-authored-by: Victor Stinner <[email protected]>
1 parent ec119dc commit 8ca75ee

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Lib/test/test_float.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ def test_short_repr(self):
829829
self.assertEqual(repr(float(negs)), str(float(negs)))
830830

831831
@support.requires_IEEE_754
832-
class RoundTestCase(unittest.TestCase):
832+
class RoundTestCase(unittest.TestCase, FloatsAreIdenticalMixin):
833833

834834
def test_inf_nan(self):
835835
self.assertRaises(OverflowError, round, INF)
@@ -859,10 +859,10 @@ def test_large_n(self):
859859

860860
def test_small_n(self):
861861
for n in [-308, -309, -400, 1-2**31, -2**31, -2**31-1, -2**100]:
862-
self.assertEqual(round(123.456, n), 0.0)
863-
self.assertEqual(round(-123.456, n), -0.0)
864-
self.assertEqual(round(1e300, n), 0.0)
865-
self.assertEqual(round(1e-320, n), 0.0)
862+
self.assertFloatsAreIdentical(round(123.456, n), 0.0)
863+
self.assertFloatsAreIdentical(round(-123.456, n), -0.0)
864+
self.assertFloatsAreIdentical(round(1e300, n), 0.0)
865+
self.assertFloatsAreIdentical(round(1e-320, n), 0.0)
866866

867867
def test_overflow(self):
868868
self.assertRaises(OverflowError, round, 1.6e308, -308)

0 commit comments

Comments
 (0)