Skip to content

Commit 625ba9b

Browse files
authored
GH-94808: Cover handling non-finite numbers from round when ndigits is provided (GH-94860)
1 parent 20b9d2a commit 625ba9b

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
@@ -831,6 +831,11 @@ def test_inf_nan(self):
831831
self.assertRaises(TypeError, round, NAN, "ceci n'est pas un integer")
832832
self.assertRaises(TypeError, round, -0.0, 1j)
833833

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

0 commit comments

Comments
 (0)