summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorsteven.bethard <devnull@localhost>2009-12-06 23:21:48 +0000
committersteven.bethard <devnull@localhost>2009-12-06 23:21:48 +0000
commitd8a9e95d1809e508aa8720b26e98510ef414aa0e (patch)
tree7cf1702382868ee22034f2e6ac5fbc57b058ae9d /test
parentb2ea34ebaac78374545e3167761acb3976807382 (diff)
downloadargparse-d8a9e95d1809e508aa8720b26e98510ef414aa0e.tar.gz
Add support for nargs='...', which allows emulation of command lines like "python [options] file [arguments]".
Diffstat (limited to 'test')
-rw-r--r--test/test_argparse.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/test_argparse.py b/test/test_argparse.py
index fadc1af..2356389 100644
--- a/test/test_argparse.py
+++ b/test/test_argparse.py
@@ -1173,6 +1173,19 @@ class TestNargsZeroOrMore(ParserTestCase):
]
+class TestNargsRemainder(ParserTestCase):
+ """Tests specifying a positional with nargs=REMAINDER"""
+
+ argument_signatures = [Sig('x'), Sig('y', nargs='...'), Sig('-z')]
+ failures = ['', '-z', '-z Z']
+ successes = [
+ ('X', NS(x='X', y=[], z=None)),
+ ('-z Z X', NS(x='X', y=[], z='Z')),
+ ('X A B -z Z', NS(x='X', y=['A', 'B', '-z', 'Z'], z=None)),
+ ('X Y --foo', NS(x='X', y=['Y', '--foo'], z=None)),
+ ]
+
+
class TestOptionLike(ParserTestCase):
"""Tests options that may or may not be arguments"""