Skip to content

Commit 952899e

Browse files
committed
add test for flag with naargs option auto completion
1 parent 4e047e9 commit 952899e

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

tests/test_shell_completion.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,19 @@ def test_option_flag():
188188
assert _get_words(cli, ["--on"], "a") == ["a1", "a2"]
189189

190190

191+
def test_flag_option_with_nargs_option():
192+
cli = Command(
193+
"cli",
194+
add_help_option=False,
195+
params=[
196+
Argument(["a"], type=Choice(["a1", "a2", "b"])),
197+
Option(["--flag"], is_flag=True),
198+
Option(["-c"], type=Choice(["p", "q"]), nargs=2),
199+
],
200+
)
201+
assert _get_words(cli, ["a1", "--flag", "-c"], "") == ["p", "q"]
202+
203+
191204
def test_option_custom():
192205
def custom(ctx, param, incomplete):
193206
return [incomplete.upper()]

0 commit comments

Comments
 (0)