Skip to content

Commit e55f60d

Browse files
[3.11] GH-94808: Cover handling non-finite numbers from round when ndigits is provided (GH-94860) (GH-94882)
(cherry picked from commit 625ba9b) Co-authored-by: Michael Droettboom <[email protected]> Automerge-Triggered-By: GH:brandtbucher
1 parent 8f92ebb commit e55f60d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Lib/test/test_float.py

+5
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,11 @@ def test_inf_nan(self):
832832
self.assertRaises(TypeError, round, NAN, "ceci n'est pas un integer")
833833
self.assertRaises(TypeError, round, -0.0, 1j)
834834

835+
def test_inf_nan_ndigits(self):
836+
self.assertEqual(round(INF, 0), INF)
837+
self.assertEqual(round(-INF, 0), -INF)
838+
self.assertTrue(math.isnan(round(NAN, 0)))
839+
835840
def test_large_n(self):
836841
for n in [324, 325, 400, 2**31-1, 2**31, 2**32, 2**100]:
837842
self.assertEqual(round(123.456, n), 123.456)

0 commit comments

Comments
 (0)