mirror of
https://github.com/python/cpython.git
synced 2025-07-12 05:45:15 +00:00
Issue 19933: Provide default argument for ndigits in round. Patch by Vajrasky Kok.
This commit is contained in:
parent
807b80d4ec
commit
cb39d1f466
4 changed files with 16 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue