diff options
author | steven.bethard <devnull@localhost> | 2010-02-28 08:37:14 +0000 |
---|---|---|
committer | steven.bethard <devnull@localhost> | 2010-02-28 08:37:14 +0000 |
commit | 3be7b3eb9fc55ddad0a5950602deabcff5f046d9 (patch) | |
tree | 064cf4da25c2d9930963c9dad7205fa00c1f8d6d /test | |
parent | f34cf60cfcb22c8929543411c15fe662849e4a6a (diff) | |
download | argparse-3be7b3eb9fc55ddad0a5950602deabcff5f046d9.tar.gz |
Better error messages for errors like type='int'. This actually caught a bug in one of the tests and as I result, this patch also makes sure that types display as their type name when %(type)s is specified.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_argparse.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/test/test_argparse.py b/test/test_argparse.py index 968843c..4392e42 100644 --- a/test/test_argparse.py +++ b/test/test_argparse.py @@ -3300,7 +3300,7 @@ class TestHelpVariableExpansion(HelpTestCase): parser_signature = Sig(prog='PROG') argument_signatures = [ - Sig('-x', type='int', + Sig('-x', type=int, help='x %(prog)s %(default)s %(type)s %%'), Sig('-y', action='store_const', default=42, const='XXX', help='y %(prog)s %(default)s %(const)s'), @@ -3770,6 +3770,9 @@ class TestInvalidArgumentConstructors(TestCase): self.assertValueError('--') self.assertValueError('---') + def test_invalid_type(self): + self.assertValueError('--foo', type='int') + def test_invalid_action(self): self.assertValueError('-x', action='foo') self.assertValueError('foo', action='baz') |