Skip to content

Commit 50f81db

Browse files
committed
revisit/improve docstrings
1 parent 2681b0a commit 50f81db

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

src/_pytest/pytester.py

+8-15
Original file line numberDiff line numberDiff line change
@@ -1341,29 +1341,18 @@ def _getlines(self, lines2: Union[str, Sequence[str], Source]) -> Sequence[str]:
13411341
return lines2
13421342

13431343
def fnmatch_lines_random(self, lines2: Sequence[str]) -> None:
1344-
"""Check lines exist in the output using in any order.
1345-
1346-
Lines are checked using ``fnmatch.fnmatch``. The argument is a list of
1347-
lines which have to occur in the output, in any order.
1344+
"""Check lines exist in the output in any order (using :func:`python:fnmatch.fnmatch`).
13481345
"""
13491346
self._match_lines_random(lines2, fnmatch)
13501347

13511348
def re_match_lines_random(self, lines2: Sequence[str]) -> None:
1352-
"""Check lines exist in the output using ``re.match``, in any order.
1353-
1354-
The argument is a list of lines which have to occur in the output, in
1355-
any order.
1349+
"""Check lines exist in the output in any order (using :func:`python:re.match`).
13561350
"""
13571351
self._match_lines_random(lines2, lambda name, pat: bool(re.match(pat, name)))
13581352

13591353
def _match_lines_random(
13601354
self, lines2: Sequence[str], match_func: Callable[[str, str], bool]
13611355
) -> None:
1362-
"""Check lines exist in the output.
1363-
1364-
The argument is a list of lines which have to occur in the output, in
1365-
any order. Each line can contain glob whildcards.
1366-
"""
13671356
lines2 = self._getlines(lines2)
13681357
for line in lines2:
13691358
for x in self.lines:
@@ -1392,22 +1381,26 @@ def _log_text(self) -> str:
13921381
return "\n".join(self._log_output)
13931382

13941383
def fnmatch_lines(self, lines2: Sequence[str]) -> None:
1395-
"""Search captured text for matching lines using ``fnmatch.fnmatch``.
1384+
"""Check lines exist in the output (using :func:`python:fnmatch.fnmatch`).
13961385
13971386
The argument is a list of lines which have to match and can use glob
13981387
wildcards. If they do not match a pytest.fail() is called. The
13991388
matches and non-matches are also shown as part of the error message.
1389+
1390+
:param lines2: string patterns to match.
14001391
"""
14011392
__tracebackhide__ = True
14021393
self._match_lines(lines2, fnmatch, "fnmatch")
14031394

14041395
def re_match_lines(self, lines2: Sequence[str]) -> None:
1405-
"""Search captured text for matching lines using ``re.match``.
1396+
"""Check lines exist in the output (using :func:`python:re.match`).
14061397
14071398
The argument is a list of lines which have to match using ``re.match``.
14081399
If they do not match a pytest.fail() is called.
14091400
14101401
The matches and non-matches are also shown as part of the error message.
1402+
1403+
:param lines2: string patterns to match.
14111404
"""
14121405
__tracebackhide__ = True
14131406
self._match_lines(

0 commit comments

Comments
 (0)