Skip to content

Commit b15a5dd

Browse files
committed
Extend test case to filtered commands
1 parent 1371d00 commit b15a5dd

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 @@ Nested (full)
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
@@ -144,3 +144,30 @@ def test_nested_full(make_app, rootdir):
144144
assert isinstance(subsection_b[1], nodes.paragraph)
145145
assert subsection_b[1].astext() == 'Greet the world.'
146146
assert isinstance(subsection_b[2], nodes.literal_block)
147+
148+
subsection_b_a = subsection_b[3]
149+
assert isinstance(subsection_b_a, nodes.section)
150+
151+
assert isinstance(subsection_b_a[0], nodes.title)
152+
assert subsection_b_a[0].astext() == 'wide'
153+
assert isinstance(subsection_b_a[1], nodes.paragraph)
154+
assert subsection_b_a[1].astext() == 'Greet all world wide things.'
155+
assert isinstance(subsection_b_a[2], nodes.literal_block)
156+
157+
subsection_b_a_a = subsection_b_a[3]
158+
assert isinstance(subsection_b_a_a, nodes.section)
159+
160+
assert isinstance(subsection_b_a_a[0], nodes.title)
161+
assert subsection_b_a_a[0].astext() == 'web'
162+
assert isinstance(subsection_b_a_a[1], nodes.paragraph)
163+
assert subsection_b_a_a[1].astext() == 'Greet the internet.'
164+
assert isinstance(subsection_b_a_a[2], nodes.literal_block)
165+
166+
subsection_b_b = subsection_b[4]
167+
assert isinstance(subsection_b_b, nodes.section)
168+
169+
assert isinstance(subsection_b_b[0], nodes.title)
170+
assert subsection_b_b[0].astext() == 'peace'
171+
assert isinstance(subsection_b_b[1], nodes.paragraph)
172+
assert subsection_b_b[1].astext() == 'Greet the world peace.'
173+
assert isinstance(subsection_b_b[2], nodes.literal_block)

0 commit comments

Comments
 (0)