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
e056e4d1
Commit
e056e4d1
authored
Aug 10, 2001
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check in a testcase for SF bug #449000: re.sub(r'\n', ...) broke.
parent
17e7be60
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
Lib/test/test_re.py
Lib/test/test_re.py
+6
-0
Lib/test/test_sre.py
Lib/test/test_sre.py
+6
-0
No files found.
Lib/test/test_re.py
View file @
e056e4d1
...
...
@@ -59,6 +59,12 @@ try:
verify(re.sub('
a
', '
\
t
\
n
\
v
\
r
\
f
\
a
', '
a
') == (chr(9)+chr(10)+chr(11)+chr(13)+chr(12)+chr(7)))
verify(re.sub('
^
\
s
*
', '
X
', '
test
') == '
Xtest
')
# Test for sub() on escaped characters, see SF bug #449000
verify(re.sub(r'
\
r
\
n
', r'
\
n
', '
abc
\
r
\
ndef
\
r
\
n
') == '
abc
\
ndef
\
n
')
verify(re.sub('
\
r
\
n
', r'
\
n
', '
abc
\
r
\
ndef
\
r
\
n
') == '
abc
\
ndef
\
n
')
verify(re.sub(r'
\
r
\
n
', '
\
n
', '
abc
\
r
\
ndef
\
r
\
n
') == '
abc
\
ndef
\
n
')
verify(re.sub('
\
r
\
n
', '
\
n
', '
abc
\
r
\
ndef
\
r
\
n
') == '
abc
\
ndef
\
n
')
except AssertionError:
raise TestFailed, "re.sub"
...
...
Lib/test/test_sre.py
View file @
e056e4d1
...
...
@@ -117,6 +117,12 @@ test(r"""sre.sub(r'a', 'b', 'aaaaa', 1)""", 'baaaa')
# bug 114660
test
(
r"""sre.sub(r'(\
S)
\s+(\
S)
', r'\1 \2', 'hello there')"""
,
'hello there'
)
# Test for sub() on escaped characters, see SF bug #449000
test
(
r"""sre.sub(r'\r\n', r'\n', 'abc\r\ndef\r\n')"""
,
'abc
\
n
def
\
n
'
)
test
(
r"""sre.sub('\r\n', r'\n', 'abc\r\ndef\r\n')"""
,
'abc
\
n
def
\
n
'
)
test
(
r"""sre.sub(r'\r\n', '\n', 'abc\r\ndef\r\n')"""
,
'abc
\
n
def
\
n
'
)
test
(
r"""sre.sub('\r\n', '\n', 'abc\r\ndef\r\n')"""
,
'abc
\
n
def
\
n
'
)
if
verbose
:
print
'Running tests on symbolic references'
...
...
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