diff options
author | steven.bethard <devnull@localhost> | 2009-12-07 00:56:45 +0000 |
---|---|---|
committer | steven.bethard <devnull@localhost> | 2009-12-07 00:56:45 +0000 |
commit | 595bce353fc65c44168df31a9cd3e29b9059b486 (patch) | |
tree | 00044595d631f68c64a1ce75fa68aa0c7ac1e36f /test | |
parent | d8a9e95d1809e508aa8720b26e98510ef414aa0e (diff) | |
download | argparse-595bce353fc65c44168df31a9cd3e29b9059b486.tar.gz |
Fix bug where --si=64 was deemed ambiguous when both --si and --size were in the parser.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_argparse.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/test_argparse.py b/test/test_argparse.py index 2356389..a7eb74a 100644 --- a/test/test_argparse.py +++ b/test/test_argparse.py @@ -401,6 +401,25 @@ class TestOptionalsDoubleDashPartialMatch(ParserTestCase): ] +class TestOptionalsDoubleDashPrefixMatch(ParserTestCase): + """Tests when one double-dash option string is a prefix of another""" + + argument_signatures = [ + Sig('--badger', action='store_true'), + Sig('--ba'), + ] + failures = ['--bar', '--b', '--ba', '--b=2', '--badge 5'] + successes = [ + ('', NS(badger=False, ba=None)), + ('--ba X', NS(badger=False, ba='X')), + ('--ba=X', NS(badger=False, ba='X')), + ('--bad', NS(badger=True, ba=None)), + ('--badg', NS(badger=True, ba=None)), + ('--badge', NS(badger=True, ba=None)), + ('--badger', NS(badger=True, ba=None)), + ] + + class TestOptionalsSingleDoubleDash(ParserTestCase): """Test an Optional with single- and double-dash option strings""" |