bpo-19072: Make @classmethod support chained decorators (GH-8405)
diff --git a/Lib/test/test_property.py b/Lib/test/test_property.py
index f6f8f5e..172737a 100644
--- a/Lib/test/test_property.py
+++ b/Lib/test/test_property.py
@@ -183,6 +183,27 @@
fake_prop.__init__('fget', 'fset', 'fdel', 'doc')
self.assertAlmostEqual(gettotalrefcount() - refs_before, 0, delta=10)
+ @unittest.skipIf(sys.flags.optimize >= 2,
+ "Docstrings are omitted with -O2 and above")
+ def test_class_property(self):
+ class A:
+ @classmethod
+ @property
+ def __doc__(cls):
+ return 'A doc for %r' % cls.__name__
+ self.assertEqual(A.__doc__, "A doc for 'A'")
+
+ @unittest.skipIf(sys.flags.optimize >= 2,
+ "Docstrings are omitted with -O2 and above")
+ def test_class_property_override(self):
+ class A:
+ """First"""
+ @classmethod
+ @property
+ def __doc__(cls):
+ return 'Second'
+ self.assertEqual(A.__doc__, 'Second')
+
# Issue 5890: subclasses of property do not preserve method __doc__ strings
class PropertySub(property):