summaryrefslogtreecommitdiff
path: root/tests/test_xml.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2018-08-30 19:23:25 -0400
committerNed Batchelder <ned@nedbatchelder.com>2018-08-30 19:23:25 -0400
commite734f26c0cf619e57a51fe9442df09e754945139 (patch)
treecf99a01baff17d1967f6d8270bff2a6761b95bf3 /tests/test_xml.py
parent04fd64ed12954b12fb0d3be219a562d3354bb4ed (diff)
downloadpython-coveragepy-git-e734f26c0cf619e57a51fe9442df09e754945139.tar.gz
Have to escape data going into a regex sub
Diffstat (limited to 'tests/test_xml.py')
-rw-r--r--tests/test_xml.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/test_xml.py b/tests/test_xml.py
index 65c1a48b..f3a9e70b 100644
--- a/tests/test_xml.py
+++ b/tests/test_xml.py
@@ -331,7 +331,7 @@ class XmlGoldTest(CoverageTest):
compare(".", gold_path("html/gold_x_xml"), left_extra=True, scrubs=[
(r' timestamp="\d+"', ' timestamp="TIMESTAMP"'),
(r' version="[-.\w]+"', ' version="VERSION"'),
- (r'<source>\s*.*?\s*</source>', '<source>%s</source>' % source_path),
+ (r'<source>\s*.*?\s*</source>', '<source>%s</source>' % re.escape(source_path)),
(r'/coverage.readthedocs.io/?[-.\w/]*', '/coverage.readthedocs.io/VER'),
])
@@ -360,7 +360,7 @@ class XmlGoldTest(CoverageTest):
compare("xml_2", gold_path("html/gold_x_xml"), scrubs=[
(r' timestamp="\d+"', ' timestamp="TIMESTAMP"'),
(r' version="[-.\w]+"', ' version="VERSION"'),
- (r'<source>\s*.*?\s*</source>', '<source>%s</source>' % source_path),
+ (r'<source>\s*.*?\s*</source>', '<source>%s</source>' % re.escape(source_path)),
(r'/coverage.readthedocs.io/?[-.\w/]*', '/coverage.readthedocs.io/VER'),
])
@@ -385,6 +385,6 @@ class XmlGoldTest(CoverageTest):
compare("y_xml_branch", gold_path("html/gold_y_xml_branch"), scrubs=[
(r' timestamp="\d+"', ' timestamp="TIMESTAMP"'),
(r' version="[-.\w]+"', ' version="VERSION"'),
- (r'<source>\s*.*?\s*</source>', '<source>%s</source>' % source_path),
+ (r'<source>\s*.*?\s*</source>', '<source>%s</source>' % re.escape(source_path)),
(r'/coverage.readthedocs.io/?[-.\w/]*', '/coverage.readthedocs.io/VER'),
])