diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-04-10 13:18:58 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-04-10 13:18:58 (GMT) |
commit | 056eb967eebe5137f9e8a257b6579945b5bca627 (patch) | |
tree | 58ea32d9a71074741deefc20962c90cfd0604785 /Lib | |
parent | 71fd224af0c8cb15039fce3c8aaeabb7215518df (diff) | |
parent | 82c920c59e3345af32c726ae0ce7aa9073a81c33 (diff) | |
download | cpython-056eb967eebe5137f9e8a257b6579945b5bca627.zip cpython-056eb967eebe5137f9e8a257b6579945b5bca627.tar.gz cpython-056eb967eebe5137f9e8a257b6579945b5bca627.tar.bz2 |
Merge heads
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_argparse.py | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py index d7f90cd..27bfad5 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -3852,34 +3852,6 @@ class TestHelpNoHelpOptional(HelpTestCase): version = '' -class TestHelpVersionOptional(HelpTestCase): - """Test that the --version argument can be suppressed help messages""" - - parser_signature = Sig(prog='PROG') - argument_signatures = [ - Sig('-v', '--version', action='version', version='1.0'), - Sig('--foo', help='foo help'), - Sig('spam', help='spam help'), - ] - argument_group_signatures = [] - usage = '''\ - usage: PROG [-h] [-v] [--foo FOO] spam - ''' - help = usage + '''\ - - positional arguments: - spam spam help - - optional arguments: - -h, --help show this help message and exit - -v, --version show program's version number and exit - --foo FOO foo help - ''' - version = '''\ - 1.0 - ''' - - class TestHelpNone(HelpTestCase): """Test that no errors occur if no help is specified""" @@ -4087,6 +4059,32 @@ class TestHelpVersionAction(HelpTestCase): ''' version = '' + +class TestHelpVersionActionSuppress(HelpTestCase): + """Test that the --version argument can be suppressed in help messages""" + + parser_signature = Sig(prog='PROG') + argument_signatures = [ + Sig('-v', '--version', action='version', version='1.0', + help=argparse.SUPPRESS), + Sig('--foo', help='foo help'), + Sig('spam', help='spam help'), + ] + argument_group_signatures = [] + usage = '''\ + usage: PROG [-h] [--foo FOO] spam + ''' + help = usage + '''\ + + positional arguments: + spam spam help + + optional arguments: + -h, --help show this help message and exit + --foo FOO foo help + ''' + + class TestHelpSubparsersOrdering(HelpTestCase): """Test ordering of subcommands in help matches the code""" parser_signature = Sig(prog='PROG', |