Fix improper use of re.escape() in tests. (GH-4814) (#4816)
(cherry picked from commit b748e3b258
)
This commit is contained in:
parent
eb2f222aae
commit
f4b814f9a2
|
@ -112,7 +112,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')
|
||||
|
|
Loading…
Reference in New Issue