gh-123446: Fix empty function names in TypeErrors in typeobject (#123470)

This commit is contained in:
sobolevn 2024-08-30 10:36:51 +03:00 committed by GitHub
parent 32c7dbb2bc
commit f8a736b8e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 63 additions and 11 deletions

View file

@ -4021,6 +4021,20 @@ class ClassPropertiesAndMethods(unittest.TestCase):
y = x ** 2
self.assertIn('unsupported operand type(s) for **', str(cm.exception))
def test_pow_wrapper_error_messages(self):
self.assertRaisesRegex(TypeError,
'expected 1 or 2 arguments, got 0',
int().__pow__)
self.assertRaisesRegex(TypeError,
'expected 1 or 2 arguments, got 3',
int().__pow__, 1, 2, 3)
self.assertRaisesRegex(TypeError,
'expected 1 or 2 arguments, got 0',
int().__rpow__)
self.assertRaisesRegex(TypeError,
'expected 1 or 2 arguments, got 3',
int().__rpow__, 1, 2, 3)
def test_mutable_bases(self):
# Testing mutable bases...