summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--tests/test_argparse_custom.py7
2 files changed, 8 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ff37f57b..9fe99019 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@
* Renamed `install_command_set()` and `uninstall_command_set()` to `register_command_set()` and
`unregister_command_set()` for better name consistency.
* Bug Fixes
+ * Fixed help formatting bug in `Cmd2ArgumentParser` when `nargs` > 1 and `metavar` is a tuple
* Added explicit testing against python 3.5.2 for Ubuntu 16.04, and 3.5.3 for Debian 9
* Added fallback definition of typing.Deque (taken from 3.5.4)
* Removed explicit type hints that fail due to a bug in 3.5.2 favoring comment-based hints instead
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()