mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #4707: round(x, n) now returns an integer when x is an integer.
Previously it returned a float.
This commit is contained in:
parent
9de29afa7c
commit
1124e71368
5 changed files with 217 additions and 33 deletions
|
@ -1068,9 +1068,9 @@ class BuiltinTest(unittest.TestCase):
|
|||
self.assertEqual(round(8), 8)
|
||||
self.assertEqual(round(-8), -8)
|
||||
self.assertEqual(type(round(0)), int)
|
||||
self.assertEqual(type(round(-8, -1)), float)
|
||||
self.assertEqual(type(round(-8, 0)), float)
|
||||
self.assertEqual(type(round(-8, 1)), float)
|
||||
self.assertEqual(type(round(-8, -1)), int)
|
||||
self.assertEqual(type(round(-8, 0)), int)
|
||||
self.assertEqual(type(round(-8, 1)), int)
|
||||
|
||||
# test new kwargs
|
||||
self.assertEqual(round(number=-8.0, ndigits=-1), -10.0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue