diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2018-08-30 19:23:25 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2018-08-30 19:23:25 -0400 |
commit | e734f26c0cf619e57a51fe9442df09e754945139 (patch) | |
tree | cf99a01baff17d1967f6d8270bff2a6761b95bf3 | |
parent | 04fd64ed12954b12fb0d3be219a562d3354bb4ed (diff) | |
download | python-coveragepy-git-e734f26c0cf619e57a51fe9442df09e754945139.tar.gz |
Have to escape data going into a regex sub
-rw-r--r-- | tests/test_xml.py | 6 |
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'), ]) |