summaryrefslogtreecommitdiff
path: root/tests/test_argparse_custom.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2020-08-13 12:54:49 -0400
committerGitHub <noreply@github.com>2020-08-13 12:54:49 -0400
commitb26974e977ec3b7406b285ce4567c68106ed4425 (patch)
tree8faed77f34a8c8f4be114b34b536e6c9ab8e6154 /tests/test_argparse_custom.py
parent133e71a5a3074fc21fa52532d00c4d2364964cd3 (diff)
parentac26caeccfd525c5ff81aa0ade0164c40faeef4c (diff)
downloadcmd2-git-b26974e977ec3b7406b285ce4567c68106ed4425.tar.gz
Merge pull request #975 from python-cmd2/help_format_fix
Fix tuple metavar crash in Cmd2HelpFormatter and ArgparseCompleter
Diffstat (limited to 'tests/test_argparse_custom.py')
-rw-r--r--tests/test_argparse_custom.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_argparse_custom.py b/tests/test_argparse_custom.py
index f4db12b6..3ce90118 100644
--- a/tests/test_argparse_custom.py
+++ b/tests/test_argparse_custom.py
@@ -260,3 +260,10 @@ def test_override_parser():
# Verify DEFAULT_ARGUMENT_PARSER is now our CustomParser
from examples.custom_parser import CustomParser
assert DEFAULT_ARGUMENT_PARSER == CustomParser
+
+
+def test_apcustom_metavar_tuple():
+ # Test the case when a tuple metavar is used with nargs an integer > 1
+ parser = Cmd2ArgumentParser()
+ parser.add_argument('--aflag', nargs=2, metavar=('foo', 'bar'), help='This is a test')
+ assert '[--aflag foo bar]' in parser.format_help()