Skip to content

Commit

Permalink
Extend test case to filtered commands
Browse files Browse the repository at this point in the history
  • Loading branch information
aeisenbarth committed Apr 3, 2024
1 parent bd77cb0 commit 1d310c9
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
26 changes: 25 additions & 1 deletion tests/roots/nested-full/greet.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,31 @@ def hello(user):
click.echo('Hello %s' % user)


@greet.command()
@greet.group()
def world():
"""Greet the world."""
click.echo('Hello world!')


@world.command()
def peace():
"""Greet the world peace."""
click.echo('Hello world peace!')


@world.command()
def traveler():
"""Greet a globetrotter."""
click.echo('Hello world traveler!')


@world.group()
def wide():
"""Greet all world wide things."""
click.echo('Hello world wide ...!')


@wide.command()
def web():
"""Greet the internet."""
click.echo('Hello world wide web!')
1 change: 1 addition & 0 deletions tests/roots/nested-full/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ Basics
.. click:: greet:greet
:prog: greet
:nested: full
:commands: hello, world, wide, web, peace
27 changes: 27 additions & 0 deletions tests/test_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,30 @@ def test_nested_full(make_app, rootdir):
assert isinstance(subsection_b[1], nodes.paragraph)
assert subsection_b[1].astext() == 'Greet the world.'
assert isinstance(subsection_b[2], nodes.literal_block)

subsection_b_a = subsection_b[3]
assert isinstance(subsection_b_a, nodes.section)

assert isinstance(subsection_b_a[0], nodes.title)
assert subsection_b_a[0].astext() == 'wide'
assert isinstance(subsection_b_a[1], nodes.paragraph)
assert subsection_b_a[1].astext() == 'Greet all world wide things.'
assert isinstance(subsection_b_a[2], nodes.literal_block)

subsection_b_a_a = subsection_b_a[3]
assert isinstance(subsection_b_a_a, nodes.section)

assert isinstance(subsection_b_a_a[0], nodes.title)
assert subsection_b_a_a[0].astext() == 'web'
assert isinstance(subsection_b_a_a[1], nodes.paragraph)
assert subsection_b_a_a[1].astext() == 'Greet the internet.'
assert isinstance(subsection_b_a_a[2], nodes.literal_block)

subsection_b_b = subsection_b[4]
assert isinstance(subsection_b_b, nodes.section)

assert isinstance(subsection_b_b[0], nodes.title)
assert subsection_b_b[0].astext() == 'peace'
assert isinstance(subsection_b_b[1], nodes.paragraph)
assert subsection_b_b[1].astext() == 'Greet the world peace.'
assert isinstance(subsection_b_b[2], nodes.literal_block)

0 comments on commit 1d310c9

Please sign in to comment.