From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 12 Dec 2017 18:49:18 +0000 (-0800) Subject: Fix improper use of re.escape() in tests. (GH-4814) (#4817) X-Git-Tag: v2.7.15rc1~100 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d663549a6a2c50450ba51f393ed6855181a36a9e;p=python Fix improper use of re.escape() in tests. (GH-4814) (#4817) (cherry picked from commit b748e3b2586e44bfc7011b601bce9cc6d16d89f1) --- diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index 174c5ca462..ae314841c6 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -58,7 +58,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('(?Px)', '\g\g', 'xx'), 'xxxx')