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 840ce4f commit 4020739Copy full SHA for 4020739
src/_pytest/python_api.py
@@ -976,11 +976,11 @@ def validate_exc(exc: type[E]) -> type[E]:
976
origin_exc: type[E] | None = get_origin(exc)
977
if origin_exc and issubclass(origin_exc, BaseExceptionGroup):
978
exc_type = get_args(exc)[0]
979
- if issubclass(origin_exc, ExceptionGroup) and exc_type in (Exception, Any):
980
- return cast(type[E], origin_exc)
981
- elif issubclass(origin_exc, BaseExceptionGroup) and exc_type in (
982
- BaseException,
983
- Any,
+ if (
+ issubclass(origin_exc, ExceptionGroup) and exc_type in (Exception, Any)
+ ) or (
+ issubclass(origin_exc, BaseExceptionGroup)
+ and exc_type in (BaseException, Any)
984
):
985
return cast(type[E], origin_exc)
986
else:
0 commit comments