From 28e44aac56ea21be8aa3bea5d93325d0edd836be Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Mon, 4 Mar 2019 20:40:28 -0500 Subject: Fix for when with_argument_list is called with preserve_quotes optional argument --- tests/test_argparse.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests') diff --git a/tests/test_argparse.py b/tests/test_argparse.py index 7db35c71..a055ac72 100644 --- a/tests/test_argparse.py +++ b/tests/test_argparse.py @@ -68,6 +68,10 @@ class ArgparseApp(cmd2.Cmd): else: self.stdout.write('False') + @cmd2.with_argument_list(preserve_quotes=True) + def do_preservelist(self, arglist): + self.stdout.write('{}'.format(arglist)) + @cmd2.with_argument_list @cmd2.with_argument_list def do_arglisttwice(self, arglist): @@ -174,6 +178,10 @@ def test_arglist(argparse_app): out = run_cmd(argparse_app, 'arglist "we should" get these') assert out[0] == 'True' +def test_preservelist(argparse_app): + out = run_cmd(argparse_app, 'preservelist foo "bar baz"') + assert out[0] == "['foo', '\"bar baz\"']" + def test_arglist_decorator_twice(argparse_app): out = run_cmd(argparse_app, 'arglisttwice "we should" get these') assert out[0] == 'we should get these' -- cgit v1.2.1