mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #29290: argparse help messages won't wrap at non-breaking spaces.
This commit is contained in:
parent
d7d87ca9b0
commit
7fe28ad837
3 changed files with 22 additions and 2 deletions
|
@ -1943,6 +1943,23 @@ class TestAddSubparsers(TestCase):
|
|||
++foo foo help
|
||||
'''))
|
||||
|
||||
def test_help_non_breaking_spaces(self):
|
||||
parser = ErrorRaisingArgumentParser(
|
||||
prog='PROG', description='main description')
|
||||
parser.add_argument(
|
||||
"--non-breaking", action='store_false',
|
||||
help='help message containing non-breaking spaces shall not '
|
||||
'wrap\N{NO-BREAK SPACE}at non-breaking spaces')
|
||||
self.assertEqual(parser.format_help(), textwrap.dedent('''\
|
||||
usage: PROG [-h] [--non-breaking]
|
||||
|
||||
main description
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
--non-breaking help message containing non-breaking spaces shall not
|
||||
wrap\N{NO-BREAK SPACE}at non-breaking spaces
|
||||
'''))
|
||||
|
||||
def test_help_alternate_prefix_chars(self):
|
||||
parser = self._get_parser(prefix_chars='+:/')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue