Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b1681189
Commit
b1681189
authored
Jan 22, 2017
by
Xiang Zhang
Browse files
Options
Browse Files
Download
Plain Diff
Issue #29290: Merge 3.5.
parents
4459e009
7fe28ad8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
1 deletion
+21
-1
Lib/argparse.py
Lib/argparse.py
+1
-1
Lib/test/test_argparse.py
Lib/test/test_argparse.py
+17
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/argparse.py
View file @
b1681189
...
...
@@ -182,7 +182,7 @@ class HelpFormatter(object):
self
.
_root_section
=
self
.
_Section
(
self
,
None
)
self
.
_current_section
=
self
.
_root_section
self
.
_whitespace_matcher
=
_re
.
compile
(
r'\
s+
')
self
.
_whitespace_matcher
=
_re
.
compile
(
r'\
s+
'
, _re.ASCII
)
self._long_break_matcher = _re.compile(r'
\
n
\
n
\
n
+
')
# ===============================
...
...
Lib/test/test_argparse.py
View file @
b1681189
...
...
@@ -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}
a
t 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}
a
t non-breaking spaces
'''
))
def
test_help_alternate_prefix_chars
(
self
):
parser
=
self
.
_get_parser
(
prefix_chars
=
'+:/'
)
...
...
Misc/NEWS
View file @
b1681189
...
...
@@ -47,6 +47,9 @@ Core and Builtins
Library
-------
- Issue #29290: Fix a regression in argparse that help messages would wrap at
non-breaking spaces.
- Issue #28735: Fixed the comparison of mock.MagickMock with mock.ANY.
- Issue #29316: Restore the provisional status of typing module, add
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment