mirror of
https://github.com/python/cpython.git
synced 2026-06-26 21:04:42 -04:00
[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:
@@ -69,6 +69,7 @@ _PYDOC_TOPIC_LABELS: Sequence[str] = sorted({
|
||||
"integers",
|
||||
"lambda",
|
||||
"lists",
|
||||
"match",
|
||||
"naming",
|
||||
"nonlocal",
|
||||
"numbers",
|
||||
|
||||
+3
-1
@@ -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',
|
||||
|
||||
@@ -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`.
|
||||
Reference in New Issue
Block a user