Skip to content

Commit

Permalink
doc/excluding.rst: Use 'literal strings' for regexes in TOML
Browse files Browse the repository at this point in the history
  • Loading branch information
allanlewis committed Jan 20, 2025
1 parent 72e74e4 commit 2a410f5
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions doc/excluding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ For example, here's a list of exclusions I've used:
"if 0:",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"class .*\\bProtocol\\):",
"@(abc\\.)?abstractmethod",
'class .*\bProtocol\):',
'@(abc\.)?abstractmethod',
]
""",
)
Expand Down Expand Up @@ -202,8 +202,8 @@ For example, here's a list of exclusions I've used:
"if 0:",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
"class .*\\bProtocol\\):",
"@(abc\\.)?abstractmethod",
'class .*\bProtocol\):',
'@(abc\.)?abstractmethod',
]

.. code-tab:: ini
Expand Down Expand Up @@ -270,11 +270,11 @@ Here are some examples:
[tool.coverage.report]
exclude_also = [
# 1. Exclude an except clause of a specific form:
"except ValueError:\\n\\s*assume\\(False\\)",
'except ValueError:\n\s*assume\(False\)',
# 2. Comments to turn coverage on and off:
"no cover: start(?s:.)*?no cover: stop",
'no cover: start(?s:.)*?no cover: stop',
# 3. A pragma comment that excludes an entire file:
"\\A(?s:.*# pragma: exclude file.*)\\Z",
'\A(?s:.*# pragma: exclude file.*)\Z',
]
""",
)
Expand All @@ -300,11 +300,11 @@ Here are some examples:
[tool.coverage.report]
exclude_also = [
# 1. Exclude an except clause of a specific form:
"except ValueError:\\n\\s*assume\\(False\\)",
'except ValueError:\n\s*assume\(False\)',
# 2. Comments to turn coverage on and off:
"no cover: start(?s:.)*?no cover: stop",
'no cover: start(?s:.)*?no cover: stop',
# 3. A pragma comment that excludes an entire file:
"\\A(?s:.*# pragma: exclude file.*)\\Z",
'\A(?s:.*# pragma: exclude file.*)\Z',
]

.. code-tab:: ini
Expand Down

0 comments on commit 2a410f5

Please sign in to comment.