diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-10-24 19:54:40 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-10-24 21:03:12 -0400 |
commit | 7d2459bb41a5c6c78f367baa6824d50ac9be05ee (patch) | |
tree | ce0e3da10b854be772e28f9e941c8a24fa4a4230 /tests/goldtest.py | |
parent | 7f202c43e24570476a91b0ab3b1b02aba2b05d3d (diff) | |
download | python-coveragepy-git-7d2459bb41a5c6c78f367baa6824d50ac9be05ee.tar.gz |
test: finishing covering goldtest.py with test_goldtest.py
Diffstat (limited to 'tests/goldtest.py')
-rw-r--r-- | tests/goldtest.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/goldtest.py b/tests/goldtest.py index b2754219..bb88b1e4 100644 --- a/tests/goldtest.py +++ b/tests/goldtest.py @@ -118,7 +118,9 @@ def contains_rx(filename, *rxlist): with open(filename) as fobj: lines = fobj.readlines() for rx in rxlist: - assert any(re.search(rx, line) for line in lines), f"Missing rx in {filename}: {rx!r}" + assert any(re.search(rx, line) for line in lines), ( + f"Missing regex in {filename}: r{rx!r}" + ) def contains_any(filename, *strlist): @@ -135,9 +137,7 @@ def contains_any(filename, *strlist): if s in text: return - assert False, ( # pragma: only failure - f"Missing content in {filename}: {strlist[0]!r} [1 of {len(strlist)}]" - ) + assert False, f"Missing content in {filename}: {strlist[0]!r} [1 of {len(strlist)}]" def doesnt_contain(filename, *strlist): @@ -180,6 +180,6 @@ def scrub(strdata, scrubs): `scrubs` is a list of (find, replace) pairs of regexes that are used on `strdata`. A string is returned. """ - for rgx_find, rgx_replace in scrubs: - strdata = re.sub(rgx_find, rgx_replace, strdata) + for rx_find, rx_replace in scrubs: + strdata = re.sub(rx_find, rx_replace, strdata) return strdata |