diff options
| author | Steven Bethard <steven.bethard@gmail.com> | 2010-11-01 15:59:35 (GMT) | 
|---|---|---|
| committer | Steven Bethard <steven.bethard@gmail.com> | 2010-11-01 15:59:35 (GMT) | 
| commit | 784dd51ad297d31ee724f38a528ba8472e4b14f9 (patch) | |
| tree | e714c18ac08124df0d72795464925bfdc665594a /Lib/test/test_argparse.py | |
| parent | 931906a7f5974865c9e928332eb6dd8ba10a91c7 (diff) | |
| download | cpython-784dd51ad297d31ee724f38a528ba8472e4b14f9.zip cpython-784dd51ad297d31ee724f38a528ba8472e4b14f9.tar.gz cpython-784dd51ad297d31ee724f38a528ba8472e4b14f9.tar.bz2  | |
Merged revisions 86090 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
  r86090 | steven.bethard | 2010-11-01 16:57:36 +0100 (Mon, 01 Nov 2010) | 1 line
  Fix bug 9352 where characters were being lost in parsing some short options
........
Diffstat (limited to 'Lib/test/test_argparse.py')
| -rw-r--r-- | Lib/test/test_argparse.py | 24 | 
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py index 349de7b..9fd8c02 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -468,6 +468,30 @@ class TestOptionalsAlternatePrefixCharsAddedHelp(ParserTestCase):          ('/ba +f', NS(f=True, bar=None, baz=42))      ] + +class TestOptionalsAlternatePrefixCharsMultipleShortArgs(ParserTestCase): +    """Verify that Optionals must be called with their defined prefixes""" + +    parser_signature = Sig(prefix_chars='+-', add_help=False) +    argument_signatures = [ +        Sig('-x', action='store_true'), +        Sig('+y', action='store_true'), +        Sig('+z', action='store_true'), +    ] +    failures = ['-w', +                '-xyz', +                '+x', +                '-y', +                '+xyz', +    ] +    successes = [ +        ('', NS(x=False, y=False, z=False)), +        ('-x', NS(x=True, y=False, z=False)), +        ('+y -x', NS(x=True, y=True, z=False)), +        ('+yz -x', NS(x=True, y=True, z=True)), +    ] + +  class TestOptionalsShortLong(ParserTestCase):      """Test a combination of single- and double-dash option strings"""  | 
