[3.13] gh-105895: Add match and case doc to help() (GH-152113) (#152128)

(cherry picked from commit 1d55b3778c)

Co-authored-by: dzherb <zherbin.dima@yandex.ru>
Co-authored-by: Stan Ulbrych <stan@python.org>
This commit is contained in:
sobolevn
2026-06-25 01:05:05 +03:00
committed by GitHub
parent d43f47bdca
commit f74dbc82fe
4 changed files with 7 additions and 2 deletions
+1
View File
@@ -69,6 +69,7 @@ _PYDOC_TOPIC_LABELS: Sequence[str] = sorted({
"integers",
"lambda",
"lists",
"match",
"naming",
"nonlocal",
"numbers",
+3 -1
View File
@@ -1832,6 +1832,7 @@ class Helper:
'async': ('async', ''),
'await': ('await', ''),
'break': ('break', 'while for'),
'case': 'match',
'class': ('class', 'CLASSES SPECIALMETHODS'),
'continue': ('continue', 'while for'),
'def': ('function', ''),
@@ -1843,11 +1844,12 @@ class Helper:
'for': ('for', 'break continue while'),
'from': 'import',
'global': ('global', 'nonlocal NAMESPACES'),
'if': ('if', 'TRUTHVALUE'),
'if': ('if', 'TRUTHVALUE match'),
'import': ('import', 'MODULES'),
'in': ('in', 'SEQUENCEMETHODS'),
'is': 'COMPARISON',
'lambda': ('lambda', 'FUNCTIONS'),
'match': ('match', 'if'),
'nonlocal': ('nonlocal', 'global NAMESPACES'),
'not': 'BOOLEAN',
'or': 'BOOLEAN',
+1 -1
View File
@@ -2198,7 +2198,7 @@ class TestHelper(unittest.TestCase):
def test_keywords(self):
self.assertEqual(sorted(pydoc.Helper.keywords),
sorted(keyword.kwlist))
sorted(keyword.kwlist + ['case', 'match']))
def test_interact_empty_line_continues(self):
# gh-138568: test pressing Enter without input should continue in help session
@@ -0,0 +1,2 @@
Add :keyword:`match` and :keyword:`case` to the list of supported topics by
:func:`help`.