summaryrefslogtreecommitdiff
path: root/Lib/test
diff options
context:
space:
mode:
authorXiang Zhang <angwerzx@126.com>2017-01-22 14:37:22 +0800
committerXiang Zhang <angwerzx@126.com>2017-01-22 14:37:22 +0800
commit9186ac78077ed6416d84b5b4a4fb570cb9f5864c (patch)
tree13b63502afcf954487bbb5d3c19ee3c0a41b69bd /Lib/test
parent7621658e7091fdbfbe18060cfea57c77f866b9c1 (diff)
downloadcpython-9186ac78077ed6416d84b5b4a4fb570cb9f5864c.tar.gz
Issue #29290: argparse help messages won't wrap at non-breaking spaces.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_argparse.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py
index 4779a13301..197d576eb6 100644
--- a/Lib/test/test_argparse.py
+++ b/Lib/test/test_argparse.py
@@ -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='+:/')