diff options
author | steven.bethard <devnull@localhost> | 2009-10-09 18:06:46 +0000 |
---|---|---|
committer | steven.bethard <devnull@localhost> | 2009-10-09 18:06:46 +0000 |
commit | 7fc9baae61b571e086e08b00e20cfa4377363cbc (patch) | |
tree | 6e41b3b3bd83df6b4aea574c2f7d33a9af797868 /test | |
parent | 7cc6c3f3317aebace4fe1e10dc926a9bf595c4f0 (diff) | |
download | argparse-7fc9baae61b571e086e08b00e20cfa4377363cbc.tar.gz |
Fix bug where options with a single letter were being considered as numbers.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_argparse.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/test_argparse.py b/test/test_argparse.py index 8860592..0bd06ca 100644 --- a/test/test_argparse.py +++ b/test/test_argparse.py @@ -1121,6 +1121,23 @@ class TestOptionalsNumericAndPositionals(ParserTestCase): ] +class TestOptionalsAlmostNumericAndPositionals(ParserTestCase): + """Tests negative number args when almost numeric options are present""" + + argument_signatures = [ + Sig('x', nargs='?'), + Sig('-k4', dest='y', action='store_true'), + ] + failures = ['-k3'] + successes = [ + ('', NS(x=None, y=False)), + ('-2', NS(x='-2', y=False)), + ('a', NS(x='a', y=False)), + ('-k4', NS(x=None, y=True)), + ('-k4 a', NS(x='a', y=True)), + ] + + class TestEmptyAndSpaceContainingArguments(ParserTestCase): argument_signatures = [ |