Skip to content

Commit 38211b8

Browse files
[mypy] Remove useless noqa, add noqa for new false positives
1 parent d472b03 commit 38211b8

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/_pytest/_io/pprint.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,15 @@ def _format(
111111
p(self, object, stream, indent, allowance, context, level + 1)
112112
context.remove(objid)
113113
elif (
114-
_dataclasses.is_dataclass(object) # type:ignore[unreachable]
114+
_dataclasses.is_dataclass(object)
115115
and not isinstance(object, type)
116-
and object.__dataclass_params__.repr
116+
and object.__dataclass_params__.repr # type:ignore[attr-defined]
117117
and
118118
# Check dataclass has generated repr method.
119119
hasattr(object.__repr__, "__wrapped__")
120120
and "__create_fn__" in object.__repr__.__wrapped__.__qualname__
121121
):
122-
context.add(objid) # type:ignore[unreachable]
122+
context.add(objid)
123123
self._pprint_dataclass(
124124
object, stream, indent, allowance, context, level + 1
125125
)

src/_pytest/capture.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def name(self) -> str:
177177
def mode(self) -> str:
178178
# TextIOWrapper doesn't expose a mode, but at least some of our
179179
# tests check it.
180-
return self.buffer.mode.replace("b", "")
180+
return self.buffer.mode.replace("b", "") # type: ignore[no-any-return,attr-defined]
181181

182182

183183
class CaptureIO(io.TextIOWrapper):
@@ -550,7 +550,7 @@ def snap(self) -> bytes:
550550
res = self.tmpfile.buffer.read()
551551
self.tmpfile.seek(0)
552552
self.tmpfile.truncate()
553-
return res
553+
return res # type: ignore[return-value]
554554

555555
def writeorg(self, data: bytes) -> None:
556556
"""Write to original file descriptor."""

testing/test_runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ def raiser(exc):
137137
ss.teardown_exact(None)
138138
mod, func = e.value.exceptions
139139
assert isinstance(mod, KeyError)
140-
assert isinstance(func.exceptions[0], TypeError) # type: ignore
141-
assert isinstance(func.exceptions[1], ValueError) # type: ignore
140+
assert isinstance(func.exceptions[0], TypeError)
141+
assert isinstance(func.exceptions[1], ValueError)
142142

143143
def test_cached_exception_doesnt_get_longer(self, pytester: Pytester) -> None:
144144
"""Regression test for #12204 (the "BTW" case)."""

0 commit comments

Comments
 (0)