summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-05-01 13:51:09 (GMT)
committerBenjamin Peterson <benjamin@python.org>2012-05-01 13:51:09 (GMT)
commit7295c6a871f9cc42a4209a8eebe2e0974194a2a3 (patch)
tree7152b99672eaa7ab1182611207d5931dd807ceab /Lib
parent42d7081806444582ee20f6cfdf7e8c88b165b0b0 (diff)
downloadcpython-7295c6a871f9cc42a4209a8eebe2e0974194a2a3.zip
cpython-7295c6a871f9cc42a4209a8eebe2e0974194a2a3.tar.gz
cpython-7295c6a871f9cc42a4209a8eebe2e0974194a2a3.tar.bz2
fix calling the classmethod descriptor directly (closes #14699)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_descr.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 2289f6e..cdaf7d2 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -1458,6 +1458,22 @@ order (MRO) for bases """
self.assertEqual(x, spam.spamlist)
self.assertEqual(a, a1)
self.assertEqual(d, d1)
+ spam_cm = spam.spamlist.__dict__['classmeth']
+ x2, a2, d2 = spam_cm(spam.spamlist, *a, **d)
+ self.assertEqual(x2, spam.spamlist)
+ self.assertEqual(a2, a1)
+ self.assertEqual(d2, d1)
+ class SubSpam(spam.spamlist): pass
+ x2, a2, d2 = spam_cm(SubSpam, *a, **d)
+ self.assertEqual(x2, SubSpam)
+ self.assertEqual(a2, a1)
+ self.assertEqual(d2, d1)
+ with self.assertRaises(TypeError):
+ spam_cm()
+ with self.assertRaises(TypeError):
+ spam_cm(spam.spamlist())
+ with self.assertRaises(TypeError):
+ spam_cm(list)
def test_staticmethods(self):
# Testing static methods...