From 37d074efc8d838ee57310fc7aa26d0679a68e2d4 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 4 Mar 2020 05:25:32 +0100 Subject: [PATCH] Fix (internal) documentation for pytester's LineComp (#6850) --- src/_pytest/pytester.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/_pytest/pytester.py b/src/_pytest/pytester.py index f383e51f6..8e27e32a7 100644 --- a/src/_pytest/pytester.py +++ b/src/_pytest/pytester.py @@ -356,7 +356,7 @@ class HookRecorder: @pytest.fixture -def linecomp(request: FixtureRequest) -> "LineComp": +def linecomp() -> "LineComp": return LineComp() @@ -1283,21 +1283,21 @@ class Testdir: class LineComp: - def __init__(self): + def __init__(self) -> None: self.stringio = StringIO() + """:class:`python:io.StringIO()` instance used for input.""" - def assert_contains_lines(self, lines2): - """Assert that lines2 are contained (linearly) in lines1. - - Return a list of extralines found. + def assert_contains_lines(self, lines2: Sequence[str]) -> None: + """Assert that ``lines2`` are contained (linearly) in :attr:`stringio`'s value. + Lines are matched using :func:`LineMatcher.fnmatch_lines`. """ __tracebackhide__ = True val = self.stringio.getvalue() self.stringio.truncate(0) self.stringio.seek(0) lines1 = val.split("\n") - return LineMatcher(lines1).fnmatch_lines(lines2) + LineMatcher(lines1).fnmatch_lines(lines2) class LineMatcher: