diff options
author | Inada Naoki <songofacandy@gmail.com> | 2019-03-26 09:26:33 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-03-26 09:26:33 (GMT) |
commit | 871309c775fd4d72048bfaa31affd54f9934f7dd (patch) | |
tree | 74a8d1910e61d82b91bf5a0d16de147a6f5a5588 /Lib/test/test_descr.py | |
parent | b4d8f28a8af4f35c951c13a5c29630d1fb401105 (diff) | |
download | cpython-871309c775fd4d72048bfaa31affd54f9934f7dd.zip cpython-871309c775fd4d72048bfaa31affd54f9934f7dd.tar.gz cpython-871309c775fd4d72048bfaa31affd54f9934f7dd.tar.bz2 |
bpo-36433: fix confusing error messages in classmethoddescr_call (GH-12556)
https://bugs.python.org/issue36433
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r-- | Lib/test/test_descr.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index e39fea6..09eef8c 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -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... |