Skip to content

Commit a117d88

Browse files
committed
doc/excluding.rst: Use 'literal strings' for regexes in TOML
1 parent c6cd6d8 commit a117d88

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

doc/excluding.rst

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,16 @@ For example, here's a list of exclusions I've used:
156156
toml=r"""
157157
[tool.coverage.report]
158158
exclude_also = [
159-
"def __repr__",
160-
"if self.debug:",
161-
"if settings.DEBUG",
162-
"raise AssertionError",
163-
"raise NotImplementedError",
164-
"if 0:",
165-
"if __name__ == .__main__.:",
166-
"if TYPE_CHECKING:",
167-
"class .*\\bProtocol\\):",
168-
"@(abc\\.)?abstractmethod",
159+
'def __repr__',
160+
'if self.debug:',
161+
'if settings.DEBUG',
162+
'raise AssertionError',
163+
'raise NotImplementedError',
164+
'if 0:',
165+
'if __name__ == .__main__.:',
166+
'if TYPE_CHECKING:',
167+
'class .*\bProtocol\):',
168+
'@(abc\.)?abstractmethod',
169169
]
170170
""",
171171
)
@@ -194,16 +194,16 @@ For example, here's a list of exclusions I've used:
194194

195195
[tool.coverage.report]
196196
exclude_also = [
197-
"def __repr__",
198-
"if self.debug:",
199-
"if settings.DEBUG",
200-
"raise AssertionError",
201-
"raise NotImplementedError",
202-
"if 0:",
203-
"if __name__ == .__main__.:",
204-
"if TYPE_CHECKING:",
205-
"class .*\\bProtocol\\):",
206-
"@(abc\\.)?abstractmethod",
197+
'def __repr__',
198+
'if self.debug:',
199+
'if settings.DEBUG',
200+
'raise AssertionError',
201+
'raise NotImplementedError',
202+
'if 0:',
203+
'if __name__ == .__main__.:',
204+
'if TYPE_CHECKING:',
205+
'class .*\bProtocol\):',
206+
'@(abc\.)?abstractmethod',
207207
]
208208

209209
.. code-tab:: ini
@@ -222,7 +222,7 @@ For example, here's a list of exclusions I've used:
222222
class .*\bProtocol\):
223223
@(abc\.)?abstractmethod
224224

225-
.. [[[end]]] (checksum: 06c7f40b1001590369df604495524f48)
225+
.. [[[end]]] (checksum: 650b209edd27112381b5f0a8d2ee0c45)
226226
227227
The :ref:`config_report_exclude_also` option adds regexes to the built-in
228228
default list so that you can add your own exclusions. The older
@@ -270,11 +270,11 @@ Here are some examples:
270270
[tool.coverage.report]
271271
exclude_also = [
272272
# 1. Exclude an except clause of a specific form:
273-
"except ValueError:\\n\\s*assume\\(False\\)",
273+
'except ValueError:\n\s*assume\(False\)',
274274
# 2. Comments to turn coverage on and off:
275-
"no cover: start(?s:.)*?no cover: stop",
275+
'no cover: start(?s:.)*?no cover: stop',
276276
# 3. A pragma comment that excludes an entire file:
277-
"\\A(?s:.*# pragma: exclude file.*)\\Z",
277+
'\A(?s:.*# pragma: exclude file.*)\Z',
278278
]
279279
""",
280280
)
@@ -300,11 +300,11 @@ Here are some examples:
300300
[tool.coverage.report]
301301
exclude_also = [
302302
# 1. Exclude an except clause of a specific form:
303-
"except ValueError:\\n\\s*assume\\(False\\)",
303+
'except ValueError:\n\s*assume\(False\)',
304304
# 2. Comments to turn coverage on and off:
305-
"no cover: start(?s:.)*?no cover: stop",
305+
'no cover: start(?s:.)*?no cover: stop',
306306
# 3. A pragma comment that excludes an entire file:
307-
"\\A(?s:.*# pragma: exclude file.*)\\Z",
307+
'\A(?s:.*# pragma: exclude file.*)\Z',
308308
]
309309

310310
.. code-tab:: ini
@@ -319,7 +319,7 @@ Here are some examples:
319319
; 3. A pragma comment that excludes an entire file:
320320
\A(?s:.*# pragma: exclude file.*)\Z
321321

322-
.. [[[end]]] (checksum: 261daf325d747cdf05310e75db827af6)
322+
.. [[[end]]] (checksum: c46e819ad9a1d3a8e37037a89d28cfde)
323323
324324
The first regex matches a specific except line followed by a specific function
325325
call. Both lines must be present for the exclusion to take effect. Note that

0 commit comments

Comments
 (0)