mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-123446: Fix empty function names in TypeError
s in typeobject
(#123470)
This commit is contained in:
parent
32c7dbb2bc
commit
f8a736b8e1
3 changed files with 63 additions and 11 deletions
|
@ -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...
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue