mirror of
https://github.com/python/cpython.git
synced 2025-10-15 03:10:29 +00:00
make __doc__ mutable on heaptypes (closes #12773)
This commit is contained in:
parent
d9f23d2004
commit
01fc6cd056
3 changed files with 25 additions and 1 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue