diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2015-04-10 16:18:33 +0300 |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-04-10 16:18:33 +0300 |
| commit | 6a7728612956f112a1e826fddc511a306597e703 (patch) | |
| tree | 90d9a8f2b643e8131ce1dbb064d2fe01d8f89982 | |
| parent | 3d2279f9a8c1e896dad4f6d2a732d08fadf6922b (diff) | |
| parent | ecb75e26db7545b05b7eee10c5e0ff0801a52794 (diff) | |
| download | cpython-git-6a7728612956f112a1e826fddc511a306597e703.tar.gz | |
Merge heads
| -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 1164f3feb9..ecc5507a59 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -3845,34 +3845,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""" @@ -4080,6 +4052,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', |
