diff options
author | David Lord <davidism@gmail.com> | 2022-02-21 20:06:24 -0800 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2022-02-21 20:06:24 -0800 |
commit | 46b78bcb80ac4f81e3248a83725c6f0adcc1089a (patch) | |
tree | f50dc47bb8b90d26b9a3bc3509444244c7f99e5c /tests | |
parent | f6a681adc13d5961073c00e57044e3855c3b76bd (diff) | |
download | click-46b78bcb80ac4f81e3248a83725c6f0adcc1089a.tar.gz |
command decorator params argument
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_command_decorators.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_command_decorators.py b/tests/test_command_decorators.py index 8d07531..9d54d7b 100644 --- a/tests/test_command_decorators.py +++ b/tests/test_command_decorators.py @@ -35,3 +35,17 @@ def test_group_no_parens(runner): result = runner.invoke(grp, ["grp2", "cmd2"]) assert result.exception is None assert result.output == "grp1\ngrp2\ncmd2\n" + + +def test_params_argument(runner): + opt = click.Argument(["a"]) + + @click.command(params=[opt]) + @click.argument("b") + def cli(a, b): + click.echo(f"{a} {b}") + + assert cli.params[0].name == "a" + assert cli.params[1].name == "b" + result = runner.invoke(cli, ["1", "2"]) + assert result.output == "1 2\n" |