Skip to content

Commit ab8434a

Browse files
miss-islingtonsobolevndzherbStanFromIreland
authored
[3.15] gh-105895: Add match and case doc to help() (GH-152113) (#152126)
gh-105895: Add `match` and `case` doc to `help()` (GH-152113) (cherry picked from commit 1d55b37) Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: dzherb <zherbin.dima@yandex.ru> Co-authored-by: Stan Ulbrych <stan@python.org>
1 parent 2d51871 commit ab8434a

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
@@ -70,6 +70,7 @@
7070
"lambda",
7171
"lazy",
7272
"lists",
73+
"match",
7374
"naming",
7475
"nonlocal",
7576
"numbers",

Lib/pydoc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1829,6 +1829,7 @@ class Helper:
18291829
'async': ('async', ''),
18301830
'await': ('await', ''),
18311831
'break': ('break', 'while for'),
1832+
'case': 'match',
18321833
'class': ('class', 'CLASSES SPECIALMETHODS'),
18331834
'continue': ('continue', 'while for'),
18341835
'def': ('function', ''),
@@ -1840,12 +1841,13 @@ class Helper:
18401841
'for': ('for', 'break continue while'),
18411842
'from': 'import',
18421843
'global': ('global', 'nonlocal NAMESPACES'),
1843-
'if': ('if', 'TRUTHVALUE'),
1844+
'if': ('if', 'TRUTHVALUE match'),
18441845
'import': ('import', 'MODULES'),
18451846
'in': ('in', 'SEQUENCEMETHODS'),
18461847
'is': 'COMPARISON',
18471848
'lambda': ('lambda', 'FUNCTIONS'),
18481849
'lazy': ('lazy', 'MODULES'),
1850+
'match': ('match', 'if'),
18491851
'nonlocal': ('nonlocal', 'global NAMESPACES'),
18501852
'not': 'BOOLEAN',
18511853
'or': 'BOOLEAN',

Lib/test/test_pydoc/test_pydoc.py

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

21732173
def test_keywords(self):
21742174
self.assertEqual(sorted(pydoc.Helper.keywords),
2175-
sorted(keyword.kwlist + ['lazy']))
2175+
sorted(keyword.kwlist + ['case', 'match', 'lazy']))
21762176

21772177
def test_interact_empty_line_continues(self):
21782178
# 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)