diff --git a/tests/roots/nested-full/greet.py b/tests/roots/nested-full/greet.py index 8981828..c6a481a 100644 --- a/tests/roots/nested-full/greet.py +++ b/tests/roots/nested-full/greet.py @@ -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!') diff --git a/tests/roots/nested-full/index.rst b/tests/roots/nested-full/index.rst index 820eb23..5b8e5ed 100644 --- a/tests/roots/nested-full/index.rst +++ b/tests/roots/nested-full/index.rst @@ -4,3 +4,4 @@ Basics .. click:: greet:greet :prog: greet :nested: full + :commands: hello, world, wide, web, peace diff --git a/tests/test_extension.py b/tests/test_extension.py index 91984d3..95339ec 100644 --- a/tests/test_extension.py +++ b/tests/test_extension.py @@ -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)