diff options
author | Steven Bethard <steven.bethard@gmail.com> | 2010-05-24 03:45:26 (GMT) |
---|---|---|
committer | Steven Bethard <steven.bethard@gmail.com> | 2010-05-24 03:45:26 (GMT) |
commit | dce6e1bd5a5b41b22be10ba119fb5b6d5546959a (patch) | |
tree | bb01d38553fc9c08a8262f2f3abd7f720178f3b7 /Lib | |
parent | 74bd9cf7d02b80f479028b24b16e25fabe9263be (diff) | |
download | cpython-dce6e1bd5a5b41b22be10ba119fb5b6d5546959a.zip cpython-dce6e1bd5a5b41b22be10ba119fb5b6d5546959a.tar.gz cpython-dce6e1bd5a5b41b22be10ba119fb5b6d5546959a.tar.bz2 |
Fix default value for version help. Approved by Benjamin on python-dev: http://mail.python.org/pipermail/python-dev/2010-May/100231.html
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/argparse.py | 2 | ||||
-rw-r--r-- | Lib/test/test_argparse.py | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/Lib/argparse.py b/Lib/argparse.py index 47386ab..f9279aa 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -987,7 +987,7 @@ class _VersionAction(Action): version=None, dest=SUPPRESS, default=SUPPRESS, - help=None): + help="show program's version number and exit"): super(_VersionAction, self).__init__( option_strings=option_strings, dest=dest, diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py index 6f1b714..30e53ab 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -3699,6 +3699,25 @@ class TestHelpArgumentDefaults(HelpTestCase): ''' version = '' +class TestHelpVersionAction(HelpTestCase): + """Test the default help for the version action""" + + parser_signature = Sig(prog='PROG', description='description') + argument_signatures = [Sig('-V', '--version', action='version', version='3.6')] + argument_group_signatures = [] + usage = '''\ + usage: PROG [-h] [-V] + ''' + help = usage + '''\ + + description + + optional arguments: + -h, --help show this help message and exit + -V, --version show program's version number and exit + ''' + version = '' + # ===================================== # Optional/Positional constructor tests # ===================================== |