mirror of
https://github.com/python/cpython.git
synced 2025-07-30 14:44:10 +00:00
Issue #11666: Teach pydoc to display full help for named tuples
This commit is contained in:
parent
f9e9a6f403
commit
9aa5a34b6b
3 changed files with 26 additions and 10 deletions
|
@ -10,8 +10,9 @@ import unittest
|
|||
import xml.etree
|
||||
import test.test_support
|
||||
from contextlib import contextmanager
|
||||
from collections import namedtuple
|
||||
from test.test_support import (
|
||||
TESTFN, forget, rmtree, EnvironmentVarGuard, reap_children)
|
||||
TESTFN, forget, rmtree, EnvironmentVarGuard, reap_children, captured_stdout)
|
||||
|
||||
from test import pydoc_mod
|
||||
|
||||
|
@ -340,6 +341,15 @@ class TestDescriptions(unittest.TestCase):
|
|||
expected = 'C in module %s object' % __name__
|
||||
self.assertIn(expected, pydoc.render_doc(c))
|
||||
|
||||
def test_namedtuple_public_underscore(self):
|
||||
NT = namedtuple('NT', ['abc', 'def'], rename=True)
|
||||
with captured_stdout() as help_io:
|
||||
help(NT)
|
||||
helptext = help_io.getvalue()
|
||||
self.assertIn('_1', helptext)
|
||||
self.assertIn('_replace', helptext)
|
||||
self.assertIn('_asdict', helptext)
|
||||
|
||||
|
||||
def test_main():
|
||||
test.test_support.run_unittest(PyDocDocTest,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue