summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-07-05 16:58:35 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-07-05 16:58:35 -0400
commit655243cb6f586e33c68928f838fcd7d921da1101 (patch)
tree226b6b1d5cf4b45e023baa7df75f8a09d1f3be95
parent1d560965bf5e03d82c4c353899ee9c7a6bf70a14 (diff)
downloadcmd2-git-655243cb6f586e33c68928f838fcd7d921da1101.tar.gz
Reorganized argparse completion and custom unit tests
-rw-r--r--tests/test_argparse_completer.py (renamed from tests/test_autocompletion.py)15
-rw-r--r--tests/test_argparse_custom.py (renamed from tests/test_acargparse.py)16
2 files changed, 15 insertions, 16 deletions
diff --git a/tests/test_autocompletion.py b/tests/test_argparse_completer.py
index 30cb5dad..4f1ed44a 100644
--- a/tests/test_autocompletion.py
+++ b/tests/test_argparse_completer.py
@@ -10,6 +10,7 @@ import pytest
import cmd2
from cmd2 import with_argparser
+from cmd2.argparse_completer import is_potential_flag
from cmd2.argparse_custom import Cmd2ArgParser
from cmd2.utils import StdSim
from .conftest import run_cmd, complete_tester
@@ -273,3 +274,17 @@ def test_autocomp_flags_choices(ac_app, flag, completions):
#
# # Since -- appeared before the -- being completed, nothing should be completed
# assert complete_tester(text, line, begidx, endidx, cmd2_app) is None
+
+def test_is_potential_flag():
+ parser = Cmd2ArgParser()
+
+ # Not valid 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
+ assert is_potential_flag('-flag', parser)
+ assert is_potential_flag('--flag', parser) \ No newline at end of file
diff --git a/tests/test_acargparse.py b/tests/test_argparse_custom.py
index c8f09f76..85587d49 100644
--- a/tests/test_acargparse.py
+++ b/tests/test_argparse_custom.py
@@ -4,7 +4,6 @@ Unit/functional testing for argparse customizations in cmd2
"""
import pytest
from cmd2.argparse_custom import Cmd2ArgParser
-from cmd2.argparse_completer import is_potential_flag
def test_acarg_narg_empty_tuple():
@@ -50,18 +49,3 @@ def test_acarg_narg_tuple_zero_base():
def test_acarg_narg_tuple_zero_to_one():
parser = Cmd2ArgParser(prog='test')
parser.add_argument('tuple', nargs=(0, 1))
-
-
-def test_is_potential_flag():
- parser = Cmd2ArgParser()
-
- # Not valid 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
- assert is_potential_flag('-flag', parser)
- assert is_potential_flag('--flag', parser)