summaryrefslogtreecommitdiff
path: root/Lib/test/test_pydoc.py
diff options
context:
space:
mode:
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,