https://github.com/python/cpython/commit/8ca75eecb0a072a87b2403c5e358b2f3d4f3b76b commit: 8ca75eecb0a072a87b2403c5e358b2f3d4f3b76b branch: 3.12 author: Miss Islington (bot) <[email protected]> committer: vstinner <[email protected]> date: 2024-09-11T12:26:35Z summary:
[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 d2b9b6f919e92184420c8e13d078e83447ce7917) Co-authored-by: Sergey B Kirpichev <[email protected]> Co-authored-by: Victor Stinner <[email protected]> files: M Lib/test/test_float.py diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py index 74c7c17993d9a6..9afaa55765e708 100644 --- a/Lib/test/test_float.py +++ b/Lib/test/test_float.py @@ -829,7 +829,7 @@ def test_short_repr(self): self.assertEqual(repr(float(negs)), str(float(negs))) @support.requires_IEEE_754 -class RoundTestCase(unittest.TestCase): +class RoundTestCase(unittest.TestCase, FloatsAreIdenticalMixin): def test_inf_nan(self): self.assertRaises(OverflowError, round, INF) @@ -859,10 +859,10 @@ def test_large_n(self): def test_small_n(self): for n in [-308, -309, -400, 1-2**31, -2**31, -2**31-1, -2**100]: - self.assertEqual(round(123.456, n), 0.0) - self.assertEqual(round(-123.456, n), -0.0) - self.assertEqual(round(1e300, n), 0.0) - self.assertEqual(round(1e-320, n), 0.0) + self.assertFloatsAreIdentical(round(123.456, n), 0.0) + self.assertFloatsAreIdentical(round(-123.456, n), -0.0) + self.assertFloatsAreIdentical(round(1e300, n), 0.0) + self.assertFloatsAreIdentical(round(1e-320, n), 0.0) def test_overflow(self): self.assertRaises(OverflowError, round, 1.6e308, -308) _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: [email protected]
