summaryrefslogtreecommitdiff
path: root/tests/test_acargparse.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-07-15 22:49:36 -0400
committerGitHub <noreply@github.com>2019-07-15 22:49:36 -0400
commit94b424e9c41f99c6eb268c6c97f09e99a8342de8 (patch)
treebcbf724e20fed985f7d05515a10d28ba32112a68 /tests/test_acargparse.py
parent8109e70b0442206103fa5fe1a3af79d1851d7ec1 (diff)
parent3ad59ceffb9810b774a93448328c7c590080cc98 (diff)
downloadcmd2-git-94b424e9c41f99c6eb268c6c97f09e99a8342de8.tar.gz
Merge pull request #718 from python-cmd2/auto_completer_refactor
Auto completer refactor
Diffstat (limited to 'tests/test_acargparse.py')
-rw-r--r--tests/test_acargparse.py66
1 files changed, 0 insertions, 66 deletions
diff --git a/tests/test_acargparse.py b/tests/test_acargparse.py
deleted file mode 100644
index 436158db..00000000
--- a/tests/test_acargparse.py
+++ /dev/null
@@ -1,66 +0,0 @@
-# flake8: noqa E302
-"""
-Unit/functional testing for argparse customizations in cmd2
-"""
-import pytest
-from cmd2.argparse_completer import ACArgumentParser, is_potential_flag
-
-
-def test_acarg_narg_empty_tuple():
- with pytest.raises(ValueError) as excinfo:
- parser = ACArgumentParser(prog='test')
- parser.add_argument('invalid_tuple', nargs=())
- assert 'Ranged values for nargs must be a tuple of 2 integers' in str(excinfo.value)
-
-
-def test_acarg_narg_single_tuple():
- with pytest.raises(ValueError) as excinfo:
- parser = ACArgumentParser(prog='test')
- parser.add_argument('invalid_tuple', nargs=(1,))
- assert 'Ranged values for nargs must be a tuple of 2 integers' in str(excinfo.value)
-
-
-def test_acarg_narg_tuple_triple():
- with pytest.raises(ValueError) as excinfo:
- parser = ACArgumentParser(prog='test')
- parser.add_argument('invalid_tuple', nargs=(1, 2, 3))
- assert 'Ranged values for nargs must be a tuple of 2 integers' in str(excinfo.value)
-
-
-def test_acarg_narg_tuple_order():
- with pytest.raises(ValueError) as excinfo:
- parser = ACArgumentParser(prog='test')
- parser.add_argument('invalid_tuple', nargs=(2, 1))
- assert 'Invalid nargs range. The first value must be less than the second' in str(excinfo.value)
-
-
-def test_acarg_narg_tuple_negative():
- with pytest.raises(ValueError) as excinfo:
- parser = ACArgumentParser(prog='test')
- parser.add_argument('invalid_tuple', nargs=(-1, 1))
- assert 'Negative numbers are invalid for nargs range' in str(excinfo.value)
-
-
-def test_acarg_narg_tuple_zero_base():
- parser = ACArgumentParser(prog='test')
- parser.add_argument('tuple', nargs=(0, 3))
-
-
-def test_acarg_narg_tuple_zero_to_one():
- parser = ACArgumentParser(prog='test')
- parser.add_argument('tuple', nargs=(0, 1))
-
-
-def test_is_potential_flag():
- parser = ACArgumentParser()
-
- # 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)