We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 38211b8 commit 3fa2fa4Copy full SHA for 3fa2fa4
src/_pytest/capture.py
@@ -15,6 +15,7 @@
15
from typing import Any
16
from typing import AnyStr
17
from typing import BinaryIO
18
+from typing import cast
19
from typing import Final
20
from typing import final
21
from typing import Generator
@@ -177,7 +178,8 @@ def name(self) -> str:
177
178
def mode(self) -> str:
179
# TextIOWrapper doesn't expose a mode, but at least some of our
180
# tests check it.
- return self.buffer.mode.replace("b", "") # type: ignore[no-any-return,attr-defined]
181
+ assert hasattr(self.buffer, "mode")
182
+ return cast(str, self.buffer.mode.replace("b", ""))
183
184
185
class CaptureIO(io.TextIOWrapper):
0 commit comments