summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkotfu <kotfu@kotfu.net>2018-01-15 11:40:13 -0700
committerkotfu <kotfu@kotfu.net>2018-01-15 11:40:13 -0700
commitc6a19be70445dcf115500ff5e944d9d2937829bb (patch)
treedcb98784eeee715fff7b7d73e18d24ef584a7f02
parent221096865ee1eae7ee0795653f4522b741b3a69b (diff)
parent38989c8d406020d300801331f86255865f133561 (diff)
downloadcmd2-git-c6a19be70445dcf115500ff5e944d9d2937829bb.tar.gz
Merge branch 'arglist' of github.com:python-cmd2/cmd2 into arglist
-rw-r--r--tests/test_argparse.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_argparse.py b/tests/test_argparse.py
index b425d63c..fea9bebb 100644
--- a/tests/test_argparse.py
+++ b/tests/test_argparse.py
@@ -81,6 +81,22 @@ class ArgparseApp(cmd2.Cmd):
self.stdout.write(' '.join(words))
self.stdout.write('\n')
+ @cmd2.with_argparser_and_unknown_args(known_parser)
+ def do_talk(self, args, extra):
+ words = []
+ for word in extra:
+ if word is None:
+ word = ''
+ if args.piglatin:
+ word = '%s%say' % (word[1:], word[0])
+ if args.shout:
+ word = word.upper()
+ words.append(word)
+ repetitions = args.repeat or 1
+ for i in range(min(repetitions, self.maxrepeats)):
+ self.stdout.write(' '.join(words))
+ self.stdout.write('\n')
+
@pytest.fixture
def argparse_app():
app = ArgparseApp()
@@ -102,6 +118,10 @@ def test_argparse_with_list(argparse_app):
out = run_cmd(argparse_app, 'speak -s hello world!')
assert out == ['HELLO WORLD!']
+def test_argparse_with_list_and_empty_doc(argparse_app):
+ out = run_cmd(argparse_app, 'speak -s hello world!')
+ assert out == ['HELLO WORLD!']
+
def test_argparse_quoted_arguments_multiple(argparse_app):
argparse_app.POSIX = False
argparse_app.STRIP_QUOTES_FOR_NON_POSIX = True