MCPcopy
hub / github.com/pallets/click / test_basic_group

Function test_basic_group

tests/test_basic.py:60–83  ·  view source on GitHub ↗
(runner)

Source from the content-addressed store, hash-verified

58
59
60def test_basic_group(runner):
61 @click.group()
62 def cli():
63 """This is the root."""
64 click.echo("ROOT EXECUTED")
65
66 @cli.command()
67 def subcommand():
68 """This is a subcommand."""
69 click.echo("SUBCOMMAND EXECUTED")
70
71 result = runner.invoke(cli, ["--help"])
72 assert not result.exception
73 assert "COMMAND [ARGS]..." in result.output
74 assert "This is the root" in result.output
75 assert "This is a subcommand." in result.output
76 assert result.exit_code == 0
77 assert "ROOT EXECUTED" not in result.output
78
79 result = runner.invoke(cli, ["subcommand"])
80 assert not result.exception
81 assert result.exit_code == 0
82 assert "ROOT EXECUTED" in result.output
83 assert "SUBCOMMAND EXECUTED" in result.output
84
85
86def test_group_commands_dict(runner):

Callers

nothing calls this directly

Calls 1

invokeMethod · 0.45

Tested by

no test coverage detected