diff options
| author | Steven Bethard <steven.bethard@gmail.com> | 2010-11-01 16:30:24 (GMT) |
|---|---|---|
| committer | Steven Bethard <steven.bethard@gmail.com> | 2010-11-01 16:30:24 (GMT) |
| commit | 68c3678253eb0bf1a15537d2725df9af15e2c913 (patch) | |
| tree | cd2983926776e3640e308fe0cc4e6918512d8458 /Lib/test/test_argparse.py | |
| parent | 784dd51ad297d31ee724f38a528ba8472e4b14f9 (diff) | |
| download | cpython-68c3678253eb0bf1a15537d2725df9af15e2c913.zip cpython-68c3678253eb0bf1a15537d2725df9af15e2c913.tar.gz cpython-68c3678253eb0bf1a15537d2725df9af15e2c913.tar.bz2 | |
Merged revisions 86092 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r86092 | steven.bethard | 2010-11-01 17:29:26 +0100 (Mon, 01 Nov 2010) | 1 line
Fix for issue 9355 where with multiple mutually exclusive arguments, some brackets were being lost in the usage messages
........
Diffstat (limited to 'Lib/test/test_argparse.py')
| -rw-r--r-- | Lib/test/test_argparse.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py index 9fd8c02..777a4af 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -2174,6 +2174,25 @@ class TestMutuallyExclusiveGroupErrors(TestCase): raises(ValueError, add_argument, 'bar', nargs=1) raises(ValueError, add_argument, 'bar', nargs=argparse.PARSER) + def test_help(self): + parser = ErrorRaisingArgumentParser(prog='PROG') + group1 = parser.add_mutually_exclusive_group() + group1.add_argument('--foo', action='store_true') + group1.add_argument('--bar', action='store_false') + group2 = parser.add_mutually_exclusive_group() + group2.add_argument('--soup', action='store_true') + group2.add_argument('--nuts', action='store_false') + expected = '''\ + usage: PROG [-h] [--foo | --bar] [--soup | --nuts] + + optional arguments: + -h, --help show this help message and exit + --foo + --bar + --soup + --nuts + ''' + self.assertEqual(parser.format_help(), textwrap.dedent(expected)) class MEMixin(object): |
