summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_property.py
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2019-08-24 22:37:25 (GMT)
committerRaymond Hettinger <rhettinger@users.noreply.github.com>2019-08-24 22:37:25 (GMT)
commit805f8f9afea116c5d4d000570e3d02ae84502f43 (patch)
treefcce9d4e198f5788b6cc5befc349c988d9c05c3c /Lib/test/test_property.py
parent0dfc025cccc5adf4f209e2421c7686b1e637eeae (diff)
downloadcpython-805f8f9afea116c5d4d000570e3d02ae84502f43.zip
cpython-805f8f9afea116c5d4d000570e3d02ae84502f43.tar.gz
cpython-805f8f9afea116c5d4d000570e3d02ae84502f43.tar.bz2
bpo-19072: Make @classmethod support chained decorators (GH-8405)
Diffstat (limited to 'Lib/test/test_property.py')
-rw-r--r--Lib/test/test_property.py21
1 files changed, 21 insertions, 0 deletions
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 @@ class PropertyTests(unittest.TestCase):
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):