From: Terry Jan Reedy <tjreedy@udel.edu>
Date: Mon, 9 Jan 2012 23:20:09 +0000 (-0500)
Subject: #11906 Make test_argparse work interactively by removing extra space
X-Git-Tag: v3.2.3rc1~200
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ee91e0990a80e44d559cb602560ee05d266617cd;p=python

#11906 Make test_argparse work interactively by removing extra space
in comparison string that argparse does not add when program name is blank.
---

diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py
index 5d213c42f4..852991c77f 100644
--- a/Lib/test/test_argparse.py
+++ b/Lib/test/test_argparse.py
@@ -2170,8 +2170,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
@@ -2187,7 +2188,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)
@@ -2203,8 +2204,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
@@ -2216,7 +2218,7 @@ class TestParentParsers(TestCase):
 
               -w W
               -x X
-        '''.format(self.main_program)))
+        '''.format(progname, ' ' if progname else '' )))
 
 # ==============================
 # Mutually exclusive group tests