mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #24064: Property() docstrings are now writeable.
(Patch by Berker Peksag.)
This commit is contained in:
parent
f2244eaf9e
commit
eac503aeac
7 changed files with 63 additions and 2 deletions
|
@ -199,6 +199,14 @@ class TestNamedTuple(unittest.TestCase):
|
|||
Point = namedtuple('Point', 'x y')
|
||||
self.assertEqual(Point.__doc__, 'Point(x, y)')
|
||||
|
||||
@unittest.skipIf(sys.flags.optimize >= 2,
|
||||
"Docstrings are omitted with -O2 and above")
|
||||
def test_doc_writable(self):
|
||||
Point = namedtuple('Point', 'x y')
|
||||
self.assertEqual(Point.x.__doc__, 'Alias for field number 0')
|
||||
Point.x.__doc__ = 'docstring for Point.x'
|
||||
self.assertEqual(Point.x.__doc__, 'docstring for Point.x')
|
||||
|
||||
def test_name_fixer(self):
|
||||
for spec, renamed in [
|
||||
[('efg', 'g%hi'), ('efg', '_1')], # field with non-alpha char
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue