diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-08-13 15:12:31 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-08-13 15:12:31 -0400 |
commit | 71367fb6e945414efc5927bbd9792dae35b8b3f9 (patch) | |
tree | fc2e567416641fa474ea0eeeef14479141189ede /tests/test_completion.py | |
parent | 69797662e50c1519a784f3768bd9142f7edf8295 (diff) | |
download | cmd2-git-71367fb6e945414efc5927bbd9792dae35b8b3f9.tar.gz |
Added capability for an argparse-based command's completer/choice functions to receive a namespace of all
arguments parsed up to token being completed. This will make it easier to have a previous argument's value
affect what data is tab-completed.
Diffstat (limited to 'tests/test_completion.py')
-rwxr-xr-x | tests/test_completion.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/tests/test_completion.py b/tests/test_completion.py index cf5dcf75..fb0d74e0 100755 --- a/tests/test_completion.py +++ b/tests/test_completion.py @@ -1179,22 +1179,14 @@ def test_cmd2_help_subcommand_completion_with_flags_before_command(scu_app): first_match = complete_tester(text, line, begidx, endidx, scu_app) assert first_match is not None and scu_app.completion_matches == ['bar', 'foo', 'sport'] -def test_complete_help_subcommand_with_no_command(scu_app): - # No command because not enough tokens +def test_complete_help_subcommand_with_blank_command(scu_app): text = '' - line = 'help ' + line = 'help "" {}'.format(text) endidx = len(line) begidx = endidx - len(text) - assert not scu_app.complete_help_subcommand(text, line, begidx, endidx) - - # No command because everything is a flag - text = '-v' - line = 'help -f -v' - endidx = len(line) - begidx = endidx - len(text) - - assert not scu_app.complete_help_subcommand(text, line, begidx, endidx) + first_match = complete_tester(text, line, begidx, endidx, scu_app) + assert first_match is None and not scu_app.completion_matches def test_cmd2_help_subcommand_completion_nomatch_scu(scu_app): |