mirror of
https://github.com/python/cpython.git
synced 2025-08-28 20:56:54 +00:00
Issue #11666: Teach pydoc to display full help for named tuples
This commit is contained in:
commit
007bdbd7ab
3 changed files with 26 additions and 10 deletions
|
@ -12,9 +12,10 @@ import unittest
|
|||
import xml.etree
|
||||
import textwrap
|
||||
from io import StringIO
|
||||
from collections import namedtuple
|
||||
from contextlib import contextmanager
|
||||
from test.support import TESTFN, forget, rmtree, EnvironmentVarGuard, \
|
||||
reap_children, captured_output
|
||||
reap_children, captured_output, captured_stdout
|
||||
|
||||
from test import pydoc_mod
|
||||
|
||||
|
@ -379,6 +380,15 @@ class PydocDocTest(unittest.TestCase):
|
|||
finally:
|
||||
pydoc.getpager = getpager_old
|
||||
|
||||
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)
|
||||
|
||||
|
||||
class TestDescriptions(unittest.TestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue