diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-07-10 14:49:04 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-07-10 14:49:04 -0400 |
commit | 2ebf63617990d1ee0ebe08f7c3938234c7c5fd24 (patch) | |
tree | e8e545a35127edceb74a43a9c3222f7fa097cf72 /tests/test_argparse_completer.py | |
parent | bb58b2f11512ce0f61d26abc9705561b5d8e903e (diff) | |
download | cmd2-git-2ebf63617990d1ee0ebe08f7c3938234c7c5fd24.tar.gz |
Fixed bug where -- wasn't stopping a REMAINDER flag and did a lot of refactoring
Diffstat (limited to 'tests/test_argparse_completer.py')
-rw-r--r-- | tests/test_argparse_completer.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/test_argparse_completer.py b/tests/test_argparse_completer.py index 6297dfb3..404ba10b 100644 --- a/tests/test_argparse_completer.py +++ b/tests/test_argparse_completer.py @@ -240,7 +240,10 @@ def ac_app(): ('--remainder static ', ['choices', 'stop', 'here']), # No more flags can appear after a REMAINDER flag) - ('--remainder static --set_value', ['choices', 'stop', 'here']) + ('--remainder static --set_value', ['choices', 'stop', 'here']), + + # Double dash ends a remainder flag + ('--remainder static --', []) ]) def test_autcomp_nargs(ac_app, args, completions): text = '' @@ -671,14 +674,15 @@ def test_is_potential_flag(): from cmd2.argparse_completer import is_potential_flag parser = Cmd2ArgParser() - # Not valid flags + # Not potential flags assert not is_potential_flag('', parser) assert not is_potential_flag('non-flag', parser) - assert not is_potential_flag('-', parser) assert not is_potential_flag('--has space', parser) assert not is_potential_flag('-2', parser) - # Valid flags + # Potential flags + assert is_potential_flag('-', parser) + assert is_potential_flag('--', parser) assert is_potential_flag('-flag', parser) assert is_potential_flag('--flag', parser) |