mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-120080: Accept `None
as a valid argument for direct call of the
int.__round__
` (#120088)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
parent
bd826b9c77
commit
57ad769076
6 changed files with 20 additions and 7 deletions
|
@ -517,6 +517,12 @@ class IntTestCases(unittest.TestCase):
|
|||
self.assertEqual(int('1_2_3_4_5_6_7_8_9', 16), 0x123456789)
|
||||
self.assertEqual(int('1_2_3_4_5_6_7', 32), 1144132807)
|
||||
|
||||
def test_round_with_none_arg_direct_call(self):
|
||||
for val in [(1).__round__(None),
|
||||
round(1),
|
||||
round(1, None)]:
|
||||
self.assertEqual(val, 1)
|
||||
self.assertIs(type(val), int)
|
||||
|
||||
class IntStrDigitLimitsTests(unittest.TestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue