Skip to content

Commit b256fc4

Browse files
committed
raises: replace ineffective type annotations
There is not much reason to use `TypeGuard` on the implementation function of an `@overload`ed function, since only the types of the overloads are used. This fixes a pyright "Overloaded implementation is not consistent with signature of overload" error.
1 parent 513c5eb commit b256fc4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/_pytest/raises.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,7 @@ def matches(
11051105
def matches(
11061106
self,
11071107
exception: BaseException | None,
1108-
) -> TypeGuard[BaseExceptionGroup[BaseExcT_co]]:
1108+
) -> bool:
11091109
"""Check if an exception matches the requirements of this RaisesGroup.
11101110
If it fails, `RaisesGroup.fail_reason` will be set.
11111111
@@ -1269,7 +1269,7 @@ def _check_exceptions(
12691269
self,
12701270
_exception: BaseException,
12711271
actual_exceptions: Sequence[BaseException],
1272-
) -> TypeGuard[BaseExceptionGroup[BaseExcT_co]]:
1272+
) -> bool:
12731273
"""Helper method for RaisesGroup.matches that attempts to pair up expected and actual exceptions"""
12741274
# The _exception parameter is not used, but necessary for the TypeGuard
12751275

0 commit comments

Comments
 (0)