Skip to content

Commit 594bb56

Browse files
committed
Add unit test and update CHANGELOG
1 parent d12a601 commit 594bb56

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Renamed `install_command_set()` and `uninstall_command_set()` to `register_command_set()` and
66
`unregister_command_set()` for better name consistency.
77
* Bug Fixes
8+
* Fixed help formatting bug in `Cmd2ArgumentParser` when `nargs` > 1 and `metavar` is a tuple
89
* Added explicit testing against python 3.5.2 for Ubuntu 16.04, and 3.5.3 for Debian 9
910
* Added fallback definition of typing.Deque (taken from 3.5.4)
1011
* Removed explicit type hints that fail due to a bug in 3.5.2 favoring comment-based hints instead

tests/test_argparse_custom.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,3 +260,10 @@ def test_override_parser():
260260
# Verify DEFAULT_ARGUMENT_PARSER is now our CustomParser
261261
from examples.custom_parser import CustomParser
262262
assert DEFAULT_ARGUMENT_PARSER == CustomParser
263+
264+
265+
def test_apcustom_metavar_tuple():
266+
# Test the case when a tuple metavar is used with nargs an integer > 1
267+
parser = Cmd2ArgumentParser()
268+
parser.add_argument('--aflag', nargs=2, metavar=('foo', 'bar'), help='This is a test')
269+
assert '[--aflag foo bar]' in parser.format_help()

0 commit comments

Comments
 (0)