diff options
author | steven.bethard <devnull@localhost> | 2009-10-24 15:54:32 +0000 |
---|---|---|
committer | steven.bethard <devnull@localhost> | 2009-10-24 15:54:32 +0000 |
commit | 57dee9ad3d9f5621f7136988d167edcce2db6100 (patch) | |
tree | 7062a1fd4d2d2dd8426504be1b7c356fb0a81682 /test | |
parent | bc9332c5e33065a637797d739363236b01eb57d3 (diff) | |
download | argparse-57dee9ad3d9f5621f7136988d167edcce2db6100.tar.gz |
Better error messages when 'dest' occurs twice for positional arguments
Diffstat (limited to 'test')
-rw-r--r-- | test/test_argparse.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/test_argparse.py b/test/test_argparse.py index c1717dc..a1c674c 100644 --- a/test/test_argparse.py +++ b/test/test_argparse.py @@ -3624,6 +3624,17 @@ class TestInvalidArgumentConstructors(TestCase): msg = 'expected %r, found %r' % (expected, e) self.failUnless(expected in str(e), msg) + def test_multiple_dest(self): + parser = argparse.ArgumentParser() + parser.add_argument(dest='foo') + try: + parser.add_argument('bar', dest='baz') + except ValueError: + e = sys.exc_info()[1] + expected = 'dest supplied twice for positional argument' + msg = 'expected %r, found %r' % (expected, e) + self.failUnless(expected in str(e), msg) + def test_no_argument_actions(self): for action in ['store_const', 'store_true', 'store_false', 'append_const', 'count']: |