diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-03-04 22:52:17 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-04 22:52:17 -0500 |
commit | 04eac4bc45d5c811e2d54113a03f1ee546901e06 (patch) | |
tree | 0f664834a86d6543287cf89ace609f3c0b3ae535 /tests/test_argparse.py | |
parent | dddf5d03c6aa9d7a4f6e953fe1529fa3d7743e39 (diff) | |
parent | d1a970bc5853aa6c1c52db923fb9b4d12ada7cf2 (diff) | |
download | cmd2-git-04eac4bc45d5c811e2d54113a03f1ee546901e06.tar.gz |
Merge pull request #636 from python-cmd2/with_argument_list
Fix bug in with_argument_list decorator
Diffstat (limited to 'tests/test_argparse.py')
-rw-r--r-- | tests/test_argparse.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test_argparse.py b/tests/test_argparse.py index 6b810b44..f5948f03 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): @@ -170,6 +174,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' |