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:
Kirill Podoprigora 2024-06-07 11:03:28 +03:00 committed by GitHub
parent bd826b9c77
commit 57ad769076
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 20 additions and 7 deletions

View file

@ -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):