diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2022-10-03 10:08:44 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2022-10-15 13:58:50 -0400 |
commit | c28544cc9a0c5113bd3a9279f47a2b7ea8826980 (patch) | |
tree | 66fc200a5044ead1a3a24d7a34b65a557ac5ac3e /tests/test_files.py | |
parent | 7836b4faa320cccdeb25966dd8fefcf89107c564 (diff) | |
download | python-coveragepy-git-c28544cc9a0c5113bd3a9279f47a2b7ea8826980.tar.gz |
refactor: since we are showing regexes, make them a bit simpler
The old code would always wrap the regex in a needless `(?s:...)`
parenthesis. Path aliases are always single regexes, so they don't need
that extra wrapping. This makes logged path maps easier to understand.
Diffstat (limited to 'tests/test_files.py')
-rw-r--r-- | tests/test_files.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/test_files.py b/tests/test_files.py index 3f3caae6..8ce2d5f7 100644 --- a/tests/test_files.py +++ b/tests/test_files.py @@ -309,9 +309,9 @@ class PathAliasesTest(CoverageTest): assert msgs == [ "Aliases (relative=True):", " Rule: '/home/*/src' -> './mysrc/' using regex " + - "'(?:(?s:[\\\\\\\\/]home[\\\\\\\\/].*[\\\\\\\\/]src[\\\\\\\\/]))'", + "'(?s:[\\\\\\\\/]home[\\\\\\\\/].*[\\\\\\\\/]src[\\\\\\\\/])'", " Rule: '/lib/*/libsrc' -> './mylib/' using regex " + - "'(?:(?s:[\\\\\\\\/]lib[\\\\\\\\/].*[\\\\\\\\/]libsrc[\\\\\\\\/]))'", + "'(?s:[\\\\\\\\/]lib[\\\\\\\\/].*[\\\\\\\\/]libsrc[\\\\\\\\/])'", "Matched path '/home/foo/src/a.py' to rule '/home/*/src' -> './mysrc/', " + "producing './mysrc/a.py'", "Matched path '/lib/foo/libsrc/a.py' to rule '/lib/*/libsrc' -> './mylib/', " + @@ -321,9 +321,9 @@ class PathAliasesTest(CoverageTest): assert msgs == [ "Aliases (relative=False):", " Rule: '/home/*/src' -> './mysrc/' using regex " + - "'(?:(?s:[\\\\\\\\/]home[\\\\\\\\/].*[\\\\\\\\/]src[\\\\\\\\/]))'", + "'(?s:[\\\\\\\\/]home[\\\\\\\\/].*[\\\\\\\\/]src[\\\\\\\\/])'", " Rule: '/lib/*/libsrc' -> './mylib/' using regex " + - "'(?:(?s:[\\\\\\\\/]lib[\\\\\\\\/].*[\\\\\\\\/]libsrc[\\\\\\\\/]))'", + "'(?s:[\\\\\\\\/]lib[\\\\\\\\/].*[\\\\\\\\/]libsrc[\\\\\\\\/])'", "Matched path '/home/foo/src/a.py' to rule '/home/*/src' -> './mysrc/', " + f"producing {files.canonical_filename('./mysrc/a.py')!r}", "Matched path '/lib/foo/libsrc/a.py' to rule '/lib/*/libsrc' -> './mylib/', " + |