Skip to content

Commit f74dbc8

Browse files
sobolevndzherbStanFromIreland
authored
[3.13] gh-105895: Add match and case doc to help() (GH-152113) (#152128)
(cherry picked from commit 1d55b37) Co-authored-by: dzherb <zherbin.dima@yandex.ru> Co-authored-by: Stan Ulbrych <stan@python.org>
1 parent d43f47b commit f74dbc8

4 files changed

Lines changed: 7 additions & 2 deletions

File tree

Doc/tools/extensions/pydoc_topics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"integers",
7070
"lambda",
7171
"lists",
72+
"match",
7273
"naming",
7374
"nonlocal",
7475
"numbers",

Lib/pydoc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1832,6 +1832,7 @@ class Helper:
18321832
'async': ('async', ''),
18331833
'await': ('await', ''),
18341834
'break': ('break', 'while for'),
1835+
'case': 'match',
18351836
'class': ('class', 'CLASSES SPECIALMETHODS'),
18361837
'continue': ('continue', 'while for'),
18371838
'def': ('function', ''),
@@ -1843,11 +1844,12 @@ class Helper:
18431844
'for': ('for', 'break continue while'),
18441845
'from': 'import',
18451846
'global': ('global', 'nonlocal NAMESPACES'),
1846-
'if': ('if', 'TRUTHVALUE'),
1847+
'if': ('if', 'TRUTHVALUE match'),
18471848
'import': ('import', 'MODULES'),
18481849
'in': ('in', 'SEQUENCEMETHODS'),
18491850
'is': 'COMPARISON',
18501851
'lambda': ('lambda', 'FUNCTIONS'),
1852+
'match': ('match', 'if'),
18511853
'nonlocal': ('nonlocal', 'global NAMESPACES'),
18521854
'not': 'BOOLEAN',
18531855
'or': 'BOOLEAN',

Lib/test/test_pydoc/test_pydoc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2198,7 +2198,7 @@ def mock_getline(prompt):
21982198

21992199
def test_keywords(self):
22002200
self.assertEqual(sorted(pydoc.Helper.keywords),
2201-
sorted(keyword.kwlist))
2201+
sorted(keyword.kwlist + ['case', 'match']))
22022202

22032203
def test_interact_empty_line_continues(self):
22042204
# gh-138568: test pressing Enter without input should continue in help session
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Add :keyword:`match` and :keyword:`case` to the list of supported topics by
2+
:func:`help`.

0 commit comments

Comments
 (0)