Fix typo in python_api.py

This commit is contained in:
Alex Hadley 2023-02-24 15:04:42 -08:00
parent 9ccae9a8e3
commit 135600fca3
No known key found for this signature in database
GPG Key ID: 138A56394E95B6BE
1 changed files with 4 additions and 4 deletions

View File

@ -808,7 +808,7 @@ def raises( # noqa: F811
:param typing.Type[E] | typing.Tuple[typing.Type[E], ...] expected_exception:
The expected exception type, or a tuple if one of multiple possible
exception types are excepted.
exception types are expected.
:kwparam str | typing.Pattern[str] | None match:
If specified, a string containing a regular expression,
or a regular expression object, that is tested against the string
@ -924,10 +924,10 @@ def raises( # noqa: F811
f"any special code to say 'this should never raise an exception'."
)
if isinstance(expected_exception, type):
excepted_exceptions: Tuple[Type[E], ...] = (expected_exception,)
expected_exceptions: Tuple[Type[E], ...] = (expected_exception,)
else:
excepted_exceptions = expected_exception
for exc in excepted_exceptions:
expected_exceptions = expected_exception
for exc in expected_exceptions:
if not isinstance(exc, type) or not issubclass(exc, BaseException):
msg = "expected exception must be a BaseException type, not {}" # type: ignore[unreachable]
not_a = exc.__name__ if isinstance(exc, type) else type(exc).__name__