summaryrefslogtreecommitdiff
path: root/test/test_argparse.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_argparse.py')
-rw-r--r--test/test_argparse.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/test/test_argparse.py b/test/test_argparse.py
index 0bd06ca..c1717dc 100644
--- a/test/test_argparse.py
+++ b/test/test_argparse.py
@@ -3613,8 +3613,16 @@ class TestInvalidArgumentConstructors(TestCase):
self.assertValueError('---')
def test_invalid_action(self):
- self.assertTypeError('-x', action='foo')
- self.assertTypeError('foo', action='baz')
+ self.assertValueError('-x', action='foo')
+ self.assertValueError('foo', action='baz')
+ parser = argparse.ArgumentParser()
+ try:
+ parser.add_argument("--foo", action="store-true")
+ except ValueError:
+ e = sys.exc_info()[1]
+ expected = 'unknown action'
+ 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',