diff options
| author | Terry Jan Reedy <tjreedy@udel.edu> | 2012-01-09 23:20:09 (GMT) | 
|---|---|---|
| committer | Terry Jan Reedy <tjreedy@udel.edu> | 2012-01-09 23:20:09 (GMT) | 
| commit | cfe6deb6f7ec42e8cb06a57d4dc540f64bb2f168 (patch) | |
| tree | 96795612b2e926d579ea85090237208d63492dc9 /Lib/test/test_argparse.py | |
| parent | df4c986f9eab5ab3e037cd41b7526e84bf18c0b4 (diff) | |
| download | cpython-cfe6deb6f7ec42e8cb06a57d4dc540f64bb2f168.zip cpython-cfe6deb6f7ec42e8cb06a57d4dc540f64bb2f168.tar.gz cpython-cfe6deb6f7ec42e8cb06a57d4dc540f64bb2f168.tar.bz2  | |
#11906 Make test_argparse work interactively by removing extra space
in comparison string that argparse does not add when program name is blank.
Diffstat (limited to 'Lib/test/test_argparse.py')
| -rw-r--r-- | Lib/test/test_argparse.py | 10 | 
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py index 28d1ef3..1a5f05e 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -2135,8 +2135,9 @@ class TestParentParsers(TestCase):          parents = [self.abcd_parent, self.wxyz_parent]          parser = ErrorRaisingArgumentParser(parents=parents)          parser_help = parser.format_help() +        progname = self.main_program          self.assertEqual(parser_help, textwrap.dedent('''\ -            usage: {} [-h] [-b B] [--d D] [--w W] [-y Y] a z +            usage: {}{}[-h] [-b B] [--d D] [--w W] [-y Y] a z              positional arguments:                a @@ -2152,7 +2153,7 @@ class TestParentParsers(TestCase):              x:                -y Y -        '''.format(self.main_program))) +        '''.format(progname, ' ' if progname else '' )))      def test_groups_parents(self):          parent = ErrorRaisingArgumentParser(add_help=False) @@ -2168,8 +2169,9 @@ class TestParentParsers(TestCase):              ['-y', 'Y', '-z', 'Z'])          parser_help = parser.format_help() +        progname = self.main_program          self.assertEqual(parser_help, textwrap.dedent('''\ -            usage: {} [-h] [-w W] [-x X] [-y Y | -z Z] +            usage: {}{}[-h] [-w W] [-x X] [-y Y | -z Z]              optional arguments:                -h, --help  show this help message and exit @@ -2181,7 +2183,7 @@ class TestParentParsers(TestCase):                -w W                -x X -        '''.format(self.main_program))) +        '''.format(progname, ' ' if progname else '' )))  # ==============================  # Mutually exclusive group tests  | 
