[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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 7 additions and 2 deletions

View file

@ -69,6 +69,7 @@
"integers",
"lambda",
"lists",
"match",
"naming",
"nonlocal",
"numbers",

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',

View file

@ -2198,7 +2198,7 @@ def mock_getline(prompt):
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

View file

@ -0,0 +1,2 @@
Add :keyword:`match` and :keyword:`case` to the list of supported topics by
:func:`help`.