(original) (raw)

changeset: 74316:b950267efd59 branch: 3.2 parent: 74313:b4194af97948 user: Terry Jan Reedy tjreedy@udel.edu date: Mon Jan 09 18:20:09 2012 -0500 files: Lib/test/test_argparse.py description: #11906 Make test_argparse work interactively by removing extra space in comparison string that argparse does not add when program name is blank. diff -r b4194af97948 -r b950267efd59 Lib/test/test_argparse.py --- a/Lib/test/test_argparse.py Mon Jan 09 21:43:18 2012 +0100 +++ b/Lib/test/test_argparse.py Mon Jan 09 18:20:09 2012 -0500 @@ -2170,8 +2170,9 @@ 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 @@ -2187,7 +2188,7 @@ x: -y Y - '''.format(self.main_program))) + '''.format(progname, ' ' if progname else '' ))) def test_groups_parents(self): parent = ErrorRaisingArgumentParser(add_help=False) @@ -2203,8 +2204,9 @@ ['-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 @@ -2216,7 +2218,7 @@ -w W -x X - '''.format(self.main_program))) + '''.format(progname, ' ' if progname else '' ))) # ============================== # Mutually exclusive group tests /tjreedy@udel.edu