summaryrefslogtreecommitdiff
path: root/tests/test_argparse.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_argparse.py')
-rw-r--r--tests/test_argparse.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/tests/test_argparse.py b/tests/test_argparse.py
index 7059e9d3..e91b4dba 100644
--- a/tests/test_argparse.py
+++ b/tests/test_argparse.py
@@ -49,7 +49,7 @@ class ArgparseApp(cmd2.Cmd):
if word is None:
word = ''
if args.piglatin:
- word = '%s%say' % (word[1:], word[0])
+ word = '{}{}ay'.format(word[1:], word[0])
if args.shout:
word = word.upper()
words.append(word)
@@ -101,7 +101,7 @@ class ArgparseApp(cmd2.Cmd):
if word is None:
word = ''
if args.piglatin:
- word = '%s%say' % (word[1:], word[0])
+ word = '{}{}ay'.format(word[1:], word[0])
if args.shout:
word = word.upper()
words.append(word)
@@ -308,8 +308,9 @@ class SubcommandApp(cmd2.Cmd):
helpless_subcmd_parser = cmd2.Cmd2ArgumentParser(add_help=False, description="A subcommand with no help")
- @cmd2.as_subcommand_to('test_subcmd_decorator', 'helpless_subcmd', helpless_subcmd_parser,
- help=helpless_subcmd_parser.description.lower())
+ @cmd2.as_subcommand_to(
+ 'test_subcmd_decorator', 'helpless_subcmd', helpless_subcmd_parser, help=helpless_subcmd_parser.description.lower()
+ )
def helpless_subcmd_func(self, args: argparse.Namespace):
# Make sure vars(Namespace) works. The way we originally added cmd2_hander to it resulted in a RecursionError.
self.poutput(vars(args))
@@ -425,6 +426,7 @@ def test_subcmd_decorator(subcommand_app):
def test_unittest_mock():
from unittest import mock
+
from cmd2 import CommandSetRegistrationError
with mock.patch.object(ArgparseApp, 'namespace_provider'):
@@ -449,12 +451,7 @@ def test_pytest_mock_invalid(mocker):
app = ArgparseApp()
-@pytest.mark.parametrize('spec_param', [
- {'spec': True},
- {'spec_set': True},
- {'autospec': True},
-])
+@pytest.mark.parametrize('spec_param', [{'spec': True}, {'spec_set': True}, {'autospec': True},])
def test_pytest_mock_valid(mocker, spec_param):
mocker.patch.object(ArgparseApp, 'namespace_provider', **spec_param)
app = ArgparseApp()
-