summaryrefslogtreecommitdiff
path: root/Lib/test/test_pydoc.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2011-03-25 16:00:13 -0700
committerRaymond Hettinger <python@rcn.com>2011-03-25 16:00:13 -0700
commit9aa5a34b6b38ef9eec67f80a8f105c8c5a7a9c10 (patch)
tree0a91fce7125acf1fa6ba1605cf5c6ccc291d0a9a /Lib/test/test_pydoc.py
parentf9e9a6f403af61c6aead4cfe766fb1efbb058171 (diff)
downloadcpython-git-9aa5a34b6b38ef9eec67f80a8f105c8c5a7a9c10.tar.gz
Issue #11666: Teach pydoc to display full help for named tuples
Diffstat (limited to 'Lib/test/test_pydoc.py')
-rw-r--r--Lib/test/test_pydoc.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py
index 0685488edb..2e67290d00 100644
--- a/Lib/test/test_pydoc.py
+++ b/Lib/test/test_pydoc.py
@@ -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,