mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-104860: Fix allow_abbrev=False for single-dash long options (GH-124340)
This commit is contained in:
parent
d08c788822
commit
49e105f948
3 changed files with 20 additions and 1 deletions
|
@ -914,6 +914,23 @@ class TestOptionalsDisallowLongAbbreviationPrefixChars(ParserTestCase):
|
|||
]
|
||||
|
||||
|
||||
class TestOptionalsDisallowSingleDashLongAbbreviation(ParserTestCase):
|
||||
"""Do not allow abbreviations of long options at all"""
|
||||
|
||||
parser_signature = Sig(allow_abbrev=False)
|
||||
argument_signatures = [
|
||||
Sig('-foo'),
|
||||
Sig('-foodle', action='store_true'),
|
||||
Sig('-foonly'),
|
||||
]
|
||||
failures = ['-foon 3', '-food', '-food -foo 2']
|
||||
successes = [
|
||||
('', NS(foo=None, foodle=False, foonly=None)),
|
||||
('-foo 3', NS(foo='3', foodle=False, foonly=None)),
|
||||
('-foonly 7 -foodle -foo 2', NS(foo='2', foodle=True, foonly='7')),
|
||||
]
|
||||
|
||||
|
||||
class TestDisallowLongAbbreviationAllowsShortGrouping(ParserTestCase):
|
||||
"""Do not allow abbreviations of long options at all"""
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue