Fix (internal) documentation for pytester's LineComp (#6850)

This commit is contained in:
Daniel Hahler 2020-03-04 05:25:32 +01:00 committed by GitHub
parent a5a8d53dfe
commit 37d074efc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -356,7 +356,7 @@ class HookRecorder:
@pytest.fixture @pytest.fixture
def linecomp(request: FixtureRequest) -> "LineComp": def linecomp() -> "LineComp":
return LineComp() return LineComp()
@ -1283,21 +1283,21 @@ class Testdir:
class LineComp: class LineComp:
def __init__(self): def __init__(self) -> None:
self.stringio = StringIO() self.stringio = StringIO()
""":class:`python:io.StringIO()` instance used for input."""
def assert_contains_lines(self, lines2): def assert_contains_lines(self, lines2: Sequence[str]) -> None:
"""Assert that lines2 are contained (linearly) in lines1. """Assert that ``lines2`` are contained (linearly) in :attr:`stringio`'s value.
Return a list of extralines found.
Lines are matched using :func:`LineMatcher.fnmatch_lines`.
""" """
__tracebackhide__ = True __tracebackhide__ = True
val = self.stringio.getvalue() val = self.stringio.getvalue()
self.stringio.truncate(0) self.stringio.truncate(0)
self.stringio.seek(0) self.stringio.seek(0)
lines1 = val.split("\n") lines1 = val.split("\n")
return LineMatcher(lines1).fnmatch_lines(lines2) LineMatcher(lines1).fnmatch_lines(lines2)
class LineMatcher: class LineMatcher: