mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +00:00
bpo-36433: fix confusing error messages in classmethoddescr_call (GH-12556)
https://bugs.python.org/issue36433
This commit is contained in:
parent
b4d8f28a8a
commit
871309c775
3 changed files with 23 additions and 9 deletions
|
|
@ -1597,12 +1597,27 @@ order (MRO) for bases """
|
|||
self.assertEqual(x2, SubSpam)
|
||||
self.assertEqual(a2, a1)
|
||||
self.assertEqual(d2, d1)
|
||||
with self.assertRaises(TypeError):
|
||||
|
||||
with self.assertRaises(TypeError) as cm:
|
||||
spam_cm()
|
||||
with self.assertRaises(TypeError):
|
||||
self.assertEqual(
|
||||
str(cm.exception),
|
||||
"descriptor 'classmeth' of 'xxsubtype.spamlist' "
|
||||
"object needs an argument")
|
||||
|
||||
with self.assertRaises(TypeError) as cm:
|
||||
spam_cm(spam.spamlist())
|
||||
with self.assertRaises(TypeError):
|
||||
self.assertEqual(
|
||||
str(cm.exception),
|
||||
"descriptor 'classmeth' requires a type "
|
||||
"but received a 'xxsubtype.spamlist' instance")
|
||||
|
||||
with self.assertRaises(TypeError) as cm:
|
||||
spam_cm(list)
|
||||
self.assertEqual(
|
||||
str(cm.exception),
|
||||
"descriptor 'classmeth' requires a subtype of 'xxsubtype.spamlist' "
|
||||
"but received 'list'")
|
||||
|
||||
def test_staticmethods(self):
|
||||
# Testing static methods...
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue