[Python-checkins] Fix improper use of re.escape() in tests. (#4814)
Serhiy Storchaka
webhook-mailer at python.org
Tue Dec 12 12:21:54 EST 2017
https://github.com/python/cpython/commit/b748e3b2586e44bfc7011b601bce9cc6d16d89f1
commit: b748e3b2586e44bfc7011b601bce9cc6d16d89f1
branch: master
author: Serhiy Storchaka <storchaka at gmail.com>
committer: GitHub <noreply at github.com>
date: 2017-12-12T19:21:50+02:00
summary:
Fix improper use of re.escape() in tests. (#4814)
files:
M Lib/test/test_re.py
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index 2344d71abf2..aaed3d893aa 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -109,7 +109,7 @@ def test_basic_re_sub(self):
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')
More information about the Python-checkins
mailing list