diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-12-12 17:21:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-12 17:21:50 (GMT) |
commit | b748e3b2586e44bfc7011b601bce9cc6d16d89f1 (patch) | |
tree | 7c6bd6dfa80d56197c5c32d22bfa2eea06557b45 /Lib/test/test_re.py | |
parent | 0e069a1597ce6791a5f0da8329da2c446766c80e (diff) | |
download | cpython-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.py | 2 |
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') |