From e86cc37841d294cfc5dc7664b05a798b595967de Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 7 Jun 2015 18:05:41 -0400 Subject: Python 3.5 raises warnings about bad escapes in re.sub replacements, so escape them more. --- tests/test_farm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_farm.py b/tests/test_farm.py index 92bd968a..d8d4c0fa 100644 --- a/tests/test_farm.py +++ b/tests/test_farm.py @@ -228,8 +228,8 @@ class FarmTestCase(object): without triggering an assertion. `right_extra` means the right directory can. - `scrubs` is a list of pairs, regex find and replace patterns to use to - scrub the files of unimportant differences. + `scrubs` is a list of pairs, regexes to find and literal strings to + replace them with to scrub the files of unimportant differences. An assertion will be raised if the directories fail one of their matches. @@ -309,7 +309,7 @@ class FarmTestCase(object): """ for rgx_find, rgx_replace in scrubs: - strdata = re.sub(rgx_find, rgx_replace, strdata) + strdata = re.sub(rgx_find, re.escape(rgx_replace), strdata) return strdata def contains(self, filename, *strlist): -- cgit v1.2.1