Issue 19933: Provide default argument for ndigits in round. Patch by Vajrasky Kok.

This commit is contained in:
Steve Dower 2015-04-15 16:10:59 -04:00
parent 807b80d4ec
commit cb39d1f466
4 changed files with 16 additions and 4 deletions

View file

@ -773,6 +773,14 @@ class RoundTestCase(unittest.TestCase):
test(sfmt, NAN, ' nan')
test(sfmt, -NAN, ' nan')
def test_None_ndigits(self):
for x in round(1.23), round(1.23, None), round(1.23, ndigits=None):
self.assertEqual(x, 1)
self.assertIsInstance(x, int)
for x in round(1.78), round(1.78, None), round(1.78, ndigits=None):
self.assertEqual(x, 2)
self.assertIsInstance(x, int)
# Beginning with Python 2.6 float has cross platform compatible
# ways to create and represent inf and nan