From bf5c76359cf9dce7a94989d7f9edd4e22e6ffa3a Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 26 Jan 2020 23:14:32 +0100 Subject: [PATCH] fixup! typing: tests: tmpfile --- src/_pytest/capture.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/_pytest/capture.py b/src/_pytest/capture.py index 33d2243b3..ccbeb0884 100644 --- a/src/_pytest/capture.py +++ b/src/_pytest/capture.py @@ -10,7 +10,7 @@ import sys from io import UnsupportedOperation from tempfile import TemporaryFile from typing import BinaryIO -from typing import List +from typing import Iterable import pytest from _pytest.compat import CaptureIO @@ -419,15 +419,15 @@ class EncodedFile: self.buffer = buffer self.encoding = encoding - def write(self, obj: str) -> int: - if not isinstance(obj, str): + def write(self, s: str) -> int: + if not isinstance(s, str): raise TypeError( - "write() argument must be str, not {}".format(type(obj).__name__) + "write() argument must be str, not {}".format(type(s).__name__) ) - return self.buffer.write(obj.encode(self.encoding, "replace")) + return self.buffer.write(s.encode(self.encoding, "replace")) - def writelines(self, linelist: List[str]) -> None: - self.buffer.writelines([x.encode(self.encoding, "replace") for x in linelist]) + def writelines(self, lines: Iterable[str]) -> None: + self.buffer.writelines(x.encode(self.encoding, "replace") for x in lines) @property def name(self) -> str: