summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_re.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-12-12 17:21:50 (GMT)
committerGitHub <noreply@github.com>2017-12-12 17:21:50 (GMT)
commitb748e3b2586e44bfc7011b601bce9cc6d16d89f1 (patch)
tree7c6bd6dfa80d56197c5c32d22bfa2eea06557b45 /Lib/test/test_re.py
parent0e069a1597ce6791a5f0da8329da2c446766c80e (diff)
downloadcpython-b748e3b2586e44bfc7011b601bce9cc6d16d89f1.zip
cpython-b748e3b2586e44bfc7011b601bce9cc6d16d89f1.tar.gz
cpython-b748e3b2586e44bfc7011b601bce9cc6d16d89f1.tar.bz2
Fix improper use of re.escape() in tests. (#4814)
Diffstat (limited to 'Lib/test/test_re.py')
-rw-r--r--Lib/test/test_re.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index 2344d71..aaed3d8 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -109,7 +109,7 @@ class ReTests(unittest.TestCase):
s = r"\1\1"
self.assertEqual(re.sub('(.)', s, 'x'), 'xx')
- self.assertEqual(re.sub('(.)', re.escape(s), 'x'), s)
+ self.assertEqual(re.sub('(.)', s.replace('\\', r'\\'), 'x'), s)
self.assertEqual(re.sub('(.)', lambda m: s, 'x'), s)
self.assertEqual(re.sub('(?P<a>x)', r'\g<a>\g<a>', 'xx'), 'xxxx')