summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_descr.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2011-08-17 17:03:47 (GMT)
committerBenjamin Peterson <benjamin@python.org>2011-08-17 17:03:47 (GMT)
commit01fc6cd056ba5b389af55c58d46fbe1a33767d0c (patch)
tree85258354d5f702a0783481f0cda64e8305ebbce1 /Lib/test/test_descr.py
parentd9f23d200426983bfb2aadf254fb84d2447a70e8 (diff)
downloadcpython-01fc6cd056ba5b389af55c58d46fbe1a33767d0c.zip
cpython-01fc6cd056ba5b389af55c58d46fbe1a33767d0c.tar.gz
cpython-01fc6cd056ba5b389af55c58d46fbe1a33767d0c.tar.bz2
make __doc__ mutable on heaptypes (closes #12773)
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r--Lib/test/test_descr.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index aade9f5..2a9f880 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -4261,6 +4261,19 @@ order (MRO) for bases """
m = str(cm.exception)
self.assertEqual("'foo' in __slots__ conflicts with class variable", m)
+ def test_set_doc(self):
+ class X:
+ "elephant"
+ X.__doc__ = "banana"
+ self.assertEqual(X.__doc__, "banana")
+ with self.assertRaises(TypeError) as cm:
+ type(list).__dict__["__doc__"].__set__(list, "blah")
+ self.assertIn("can't set list.__doc__", str(cm.exception))
+ with self.assertRaises(TypeError) as cm:
+ type(X).__dict__["__doc__"].__delete__(X)
+ self.assertIn("can't delete X.__doc__", str(cm.exception))
+ self.assertEqual(X.__doc__, "banana")
+
class DictProxyTests(unittest.TestCase):
def setUp(self):
class C(object):