-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Closed
Closed
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
state_group = parser.add_mutually_exclusive_group()
state_group.add_argument('--param1', nargs='?', const='default', metavar='NAME',
help=SUPPRESS)
state_group.add_argument('--param2', nargs='?', const='default', metavar='NAME',
help=SUPPRESS)will cause an assert in
assert ' '.join(opt_parts) == opt_usage
of argparse.py
because the empty group [] is converted into two spaces
e.g.
[group1] [] [group 2]
gets converted to this by the opt_usage = format(optionals, groups) code above the assert:
[group1] [group 2]
and the two spaces don't match the single space of the assert
Your environment
- CPython versions tested on: 3.10.4
- Operating system and architecture: OSX, arm64
blundell
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
Status
Doc issues