Skip to content

Commit

Permalink
add test for flag with naargs option auto completion
Browse files Browse the repository at this point in the history
  • Loading branch information
msaipraneeth committed Jan 22, 2025
1 parent caadd83 commit c9e86aa
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_shell_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,19 @@ def test_option_flag():
assert _get_words(cli, ["--on"], "a") == ["a1", "a2"]


def test_flag_option_with_nargs_option():
cli = Command(
"cli",
add_help_option=False,
params=[
Argument(["a"], type=Choice(["a1", "a2", "b"])),
Option(["--flag"], is_flag=True),
Option(["-c"], type=Choice(["p", "q"]), nargs=2),
],
)
assert _get_words(cli, ["a1", "--flag", "-c"], "") == ["p", "q"]


def test_option_custom():
def custom(ctx, param, incomplete):
return [incomplete.upper()]
Expand Down

0 comments on commit c9e86aa

Please sign in to comment.