summaryrefslogtreecommitdiff
path: root/tests/test_argparse_custom.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2021-02-19 21:35:13 -0500
committerTodd Leonhardt <todd.leonhardt@gmail.com>2021-02-19 21:35:13 -0500
commit3e180a810e9c4b9d251c135667d1d150b0bbd0dd (patch)
tree03e49d5da86d40efa9118eccfd8bd4bbf3dcf86b /tests/test_argparse_custom.py
parent4c70bdb03d34c43f833bf77c441452cd402d0715 (diff)
parent06aaf962689840631325c70ea7e9056d176c7f67 (diff)
downloadcmd2-git-3e180a810e9c4b9d251c135667d1d150b0bbd0dd.tar.gz
Merge branch 'master' into black
# Conflicts: # cmd2/__init__.py # cmd2/argparse_completer.py # cmd2/argparse_custom.py # cmd2/cmd2.py # cmd2/decorators.py # cmd2/exceptions.py # cmd2/utils.py # examples/arg_decorators.py # examples/argparse_completion.py # examples/modular_commands_main.py # tests/test_argparse_completer.py # tests/test_argparse_custom.py # tests/test_cmd2.py # tests/test_completion.py # tests/test_history.py
Diffstat (limited to 'tests/test_argparse_custom.py')
-rw-r--r--tests/test_argparse_custom.py43
1 files changed, 13 insertions, 30 deletions
diff --git a/tests/test_argparse_custom.py b/tests/test_argparse_custom.py
index dd227355..2f2ee777 100644
--- a/tests/test_argparse_custom.py
+++ b/tests/test_argparse_custom.py
@@ -48,18 +48,11 @@ def fake_func():
pass
-@pytest.mark.parametrize(
- 'kwargs, is_valid',
- [
- ({'choices_function': fake_func}, True),
- ({'choices_method': fake_func}, True),
- ({'completer_function': fake_func}, True),
- ({'completer_method': fake_func}, True),
- ({'choices_function': fake_func, 'choices_method': fake_func}, False),
- ({'choices_method': fake_func, 'completer_function': fake_func}, False),
- ({'completer_function': fake_func, 'completer_method': fake_func}, False),
- ],
-)
+@pytest.mark.parametrize('kwargs, is_valid', [
+ ({'choices_provider': fake_func}, True),
+ ({'completer': fake_func}, True),
+ ({'choices_provider': fake_func, 'completer': fake_func}, False),
+])
def test_apcustom_choices_callable_count(kwargs, is_valid):
parser = Cmd2ArgumentParser()
try:
@@ -70,15 +63,10 @@ def test_apcustom_choices_callable_count(kwargs, is_valid):
assert 'Only one of the following parameters' in str(ex)
-@pytest.mark.parametrize(
- 'kwargs',
- [
- ({'choices_function': fake_func}),
- ({'choices_method': fake_func}),
- ({'completer_function': fake_func}),
- ({'completer_method': fake_func}),
- ],
-)
+@pytest.mark.parametrize('kwargs', [
+ ({'choices_provider': fake_func}),
+ ({'completer': fake_func})
+])
def test_apcustom_no_choices_callables_alongside_choices(kwargs):
with pytest.raises(TypeError) as excinfo:
parser = Cmd2ArgumentParser()
@@ -86,15 +74,10 @@ def test_apcustom_no_choices_callables_alongside_choices(kwargs):
assert 'None of the following parameters can be used alongside a choices parameter' in str(excinfo.value)
-@pytest.mark.parametrize(
- 'kwargs',
- [
- ({'choices_function': fake_func}),
- ({'choices_method': fake_func}),
- ({'completer_function': fake_func}),
- ({'completer_method': fake_func}),
- ],
-)
+@pytest.mark.parametrize('kwargs', [
+ ({'choices_provider': fake_func}),
+ ({'completer': fake_func})
+])
def test_apcustom_no_choices_callables_when_nargs_is_0(kwargs):
with pytest.raises(TypeError) as excinfo:
parser = Cmd2ArgumentParser()