From 2ebf63617990d1ee0ebe08f7c3938234c7c5fd24 Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Wed, 10 Jul 2019 14:49:04 -0400 Subject: Fixed bug where -- wasn't stopping a REMAINDER flag and did a lot of refactoring --- tests/test_argparse_completer.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'tests/test_argparse_completer.py') 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) -- cgit v1.2.1