Skip to content

Commit 1d310c9

Browse files
committed
Extend test case to filtered commands
1 parent bd77cb0 commit 1d310c9

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed

tests/roots/nested-full/greet.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,31 @@ def hello(user):
1616
click.echo('Hello %s' % user)
1717

1818

19-
@greet.command()
19+
@greet.group()
2020
def world():
2121
"""Greet the world."""
2222
click.echo('Hello world!')
23+
24+
25+
@world.command()
26+
def peace():
27+
"""Greet the world peace."""
28+
click.echo('Hello world peace!')
29+
30+
31+
@world.command()
32+
def traveler():
33+
"""Greet a globetrotter."""
34+
click.echo('Hello world traveler!')
35+
36+
37+
@world.group()
38+
def wide():
39+
"""Greet all world wide things."""
40+
click.echo('Hello world wide ...!')
41+
42+
43+
@wide.command()
44+
def web():
45+
"""Greet the internet."""
46+
click.echo('Hello world wide web!')

tests/roots/nested-full/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ Basics
44
.. click:: greet:greet
55
:prog: greet
66
:nested: full
7+
:commands: hello, world, wide, web, peace

tests/test_extension.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,30 @@ def test_nested_full(make_app, rootdir):
102102
assert isinstance(subsection_b[1], nodes.paragraph)
103103
assert subsection_b[1].astext() == 'Greet the world.'
104104
assert isinstance(subsection_b[2], nodes.literal_block)
105+
106+
subsection_b_a = subsection_b[3]
107+
assert isinstance(subsection_b_a, nodes.section)
108+
109+
assert isinstance(subsection_b_a[0], nodes.title)
110+
assert subsection_b_a[0].astext() == 'wide'
111+
assert isinstance(subsection_b_a[1], nodes.paragraph)
112+
assert subsection_b_a[1].astext() == 'Greet all world wide things.'
113+
assert isinstance(subsection_b_a[2], nodes.literal_block)
114+
115+
subsection_b_a_a = subsection_b_a[3]
116+
assert isinstance(subsection_b_a_a, nodes.section)
117+
118+
assert isinstance(subsection_b_a_a[0], nodes.title)
119+
assert subsection_b_a_a[0].astext() == 'web'
120+
assert isinstance(subsection_b_a_a[1], nodes.paragraph)
121+
assert subsection_b_a_a[1].astext() == 'Greet the internet.'
122+
assert isinstance(subsection_b_a_a[2], nodes.literal_block)
123+
124+
subsection_b_b = subsection_b[4]
125+
assert isinstance(subsection_b_b, nodes.section)
126+
127+
assert isinstance(subsection_b_b[0], nodes.title)
128+
assert subsection_b_b[0].astext() == 'peace'
129+
assert isinstance(subsection_b_b[1], nodes.paragraph)
130+
assert subsection_b_b[1].astext() == 'Greet the world peace.'
131+
assert isinstance(subsection_b_b[2], nodes.literal_block)

0 commit comments

Comments
 (0)