]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix default value for version help. Approved by Benjamin on python-dev: http://mail...
authorSteven Bethard <steven.bethard@gmail.com>
Mon, 24 May 2010 03:45:26 +0000 (03:45 +0000)
committerSteven Bethard <steven.bethard@gmail.com>
Mon, 24 May 2010 03:45:26 +0000 (03:45 +0000)
Lib/argparse.py
Lib/test/test_argparse.py

index 47386ab660eb9aa659fb2be2c9eae2a3749166f4..f9279aa5446e0d7ac18621e086ad9081a9b456fa 100644 (file)
@@ -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,
index 6f1b714ef250beaa024baba686abc7aa6ce11678..30e53abf19d972242425d0dcd42db699d97abdd2 100644 (file)
@@ -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
 # =====================================