Skip to content

Commit

Permalink
pythongh-94808: Cover handling non-finite numbers from round when ndi…
Browse files Browse the repository at this point in the history
…gits is provided
  • Loading branch information
mdboom committed Jul 14, 2022
1 parent 0c66074 commit 3cd7327
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Lib/test/test_float.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,11 @@ def test_inf_nan(self):
self.assertRaises(TypeError, round, NAN, "ceci n'est pas un integer")
self.assertRaises(TypeError, round, -0.0, 1j)

def test_inf_nan_ndigits(self):
self.assertEqual(round(INF, 0), INF)
self.assertEqual(round(-INF, 0), -INF)
self.assertTrue(math.isnan(round(NAN, 0)))

def test_large_n(self):
for n in [324, 325, 400, 2**31-1, 2**31, 2**32, 2**100]:
self.assertEqual(round(123.456, n), 123.456)
Expand Down

0 comments on commit 3cd7327

Please sign in to comment.