diff options
Diffstat (limited to 'test/test_argparse.py')
-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 = [ |