Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Lib/pydoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2028,12 +2028,12 @@ class Helper:

topics = {
'TYPES': ('types', 'STRINGS UNICODE NUMBERS SEQUENCES MAPPINGS '
'FUNCTIONS CLASSES MODULES FILES inspect'),
'FUNCTIONS CLASSES MODULES inspect'),
'STRINGS': ('strings', 'str UNICODE SEQUENCES STRINGMETHODS '
'FORMATTING TYPES'),
'STRINGMETHODS': ('string-methods', 'STRINGS FORMATTING'),
'FORMATTING': ('formatstrings', 'OPERATORS'),
'UNICODE': ('strings', 'encodings unicode SEQUENCES STRINGMETHODS '
'UNICODE': ('strings', 'encodings SEQUENCES STRINGMETHODS '
'FORMATTING TYPES'),
'NUMBERS': ('numbers', 'INTEGER FLOAT COMPLEX TYPES'),
'INTEGER': ('integers', 'int range'),
Expand Down
13 changes: 13 additions & 0 deletions Lib/test/test_pydoc/test_pydoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2294,6 +2294,19 @@ def test_keywords(self):
self.assertEqual(sorted(pydoc.Helper.keywords),
sorted(keyword.kwlist + ['case', 'match', 'lazy']))

def test_related_topics(self):
# Every related help topic and alias must be something help() can
# document.
for name, target in (*pydoc.Helper.topics.items(),
*pydoc.Helper.keywords.items()):
if isinstance(target, str):
target = ('', target)
for xref in target[1].split():
with self.subTest(topic=name, xref=xref):
Comment thread
sobolevn marked this conversation as resolved.
Resolved
buf = StringIO()
pydoc.Helper(output=buf).help(xref)
self.assertNotIn('No help entry found', buf.getvalue())

def test_symbols(self):
# gh-161414
for symbol in pydoc.Helper.symbols:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Remove ``FILES`` and ``unicode`` from the related help topics listed by
:func:`help` for the ``TYPES`` and ``UNICODE`` topics. Neither exists in
Python 3, so asking for help on them failed.
Loading