mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-38956: don't print BooleanOptionalAction's default twice (GH-27672)
Co-authored-by: Micky Yun Chan <michan@redhat.com>
(cherry picked from commit 1512bc21d6
)
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
This commit is contained in:
parent
8516ca500e
commit
6f6648e436
3 changed files with 16 additions and 8 deletions
|
@ -4262,6 +4262,9 @@ class TestHelpArgumentDefaults(HelpTestCase):
|
|||
argument_signatures = [
|
||||
Sig('--foo', help='foo help - oh and by the way, %(default)s'),
|
||||
Sig('--bar', action='store_true', help='bar help'),
|
||||
Sig('--taz', action=argparse.BooleanOptionalAction,
|
||||
help='Whether to taz it', default=True),
|
||||
Sig('--quux', help="Set the quux", default=42),
|
||||
Sig('spam', help='spam help'),
|
||||
Sig('badger', nargs='?', default='wooden', help='badger help'),
|
||||
]
|
||||
|
@ -4270,25 +4273,29 @@ class TestHelpArgumentDefaults(HelpTestCase):
|
|||
[Sig('--baz', type=int, default=42, help='baz help')]),
|
||||
]
|
||||
usage = '''\
|
||||
usage: PROG [-h] [--foo FOO] [--bar] [--baz BAZ] spam [badger]
|
||||
usage: PROG [-h] [--foo FOO] [--bar] [--taz | --no-taz] [--quux QUUX]
|
||||
[--baz BAZ]
|
||||
spam [badger]
|
||||
'''
|
||||
help = usage + '''\
|
||||
|
||||
description
|
||||
|
||||
positional arguments:
|
||||
spam spam help
|
||||
badger badger help (default: wooden)
|
||||
spam spam help
|
||||
badger badger help (default: wooden)
|
||||
|
||||
options:
|
||||
-h, --help show this help message and exit
|
||||
--foo FOO foo help - oh and by the way, None
|
||||
--bar bar help (default: False)
|
||||
-h, --help show this help message and exit
|
||||
--foo FOO foo help - oh and by the way, None
|
||||
--bar bar help (default: False)
|
||||
--taz, --no-taz Whether to taz it (default: True)
|
||||
--quux QUUX Set the quux (default: 42)
|
||||
|
||||
title:
|
||||
description
|
||||
|
||||
--baz BAZ baz help (default: 42)
|
||||
--baz BAZ baz help (default: 42)
|
||||
'''
|
||||
version = ''
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue