summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorkotfu <kotfu@kotfu.net>2018-01-12 22:28:29 -0700
committerkotfu <kotfu@kotfu.net>2018-01-12 22:28:29 -0700
commitc26b00853633c7df8cdee0ee49b3596154bb09c1 (patch)
tree0597386fa8856c74093bb79534b394565ce24ebf /tests
parent19c0586b45204ac264038ce23da89858aefda46f (diff)
downloadcmd2-git-c26b00853633c7df8cdee0ee49b3596154bb09c1.tar.gz
new @with_argument_list decorator
Diffstat (limited to 'tests')
-rw-r--r--tests/test_argparse.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/test_argparse.py b/tests/test_argparse.py
index 1ca455e9..308824cf 100644
--- a/tests/test_argparse.py
+++ b/tests/test_argparse.py
@@ -58,7 +58,14 @@ class ArgparseApp(cmd2.Cmd):
argparser = argparse.ArgumentParser()
argparser.add_argument('args', nargs='*')
@cmd2.with_argument_parser(argparser)
- def do_arglist(self, arglist, args=None):
+ def do_argparse_arglist(self, arglist, args=None):
+ if isinstance(arglist, list):
+ self.stdout.write('True')
+ else:
+ self.stdout.write('False')
+
+ @cmd2.with_argument_list
+ def do_arglist(self, arglist):
if isinstance(arglist, list):
self.stdout.write('True')
else:
@@ -114,5 +121,9 @@ def test_argparse_cmdline(argparse_app):
assert out[0] == 'True'
def test_argparse_arglist(argparse_app):
- out = run_cmd(argparse_app, 'arglist "some arguments" and some more')
+ out = run_cmd(argparse_app, 'argparse_arglist "some arguments" and some more')
+ assert out[0] == 'True'
+
+def test_arglist(argparse_app):
+ out = run_cmd(argparse_app, 'arglist "we should" get these in a list, not a string')
assert out[0] == 'True'