Hello there!
SanicASGITestClient inherits from httpx.AsyncClient and override its request method, changing its return type.
class SanicASGITestClient(httpx.AsyncClient):
async def request( # type: ignore
self, method, url, gather_request=True, *args, **kwargs
) -> typing.Tuple[
typing.Optional[Request], typing.Optional[TestingResponse]
]:
...
class AsyncClient(BaseClient):
async def request(
self,
method: str,
url: URL | str,
*,
content: RequestContent | None = None,
data: RequestData | None = None,
files: RequestFiles | None = None,
json: typing.Any | None = None,
params: QueryParamTypes | None = None,
headers: HeaderTypes | None = None,
cookies: CookieTypes | None = None,
auth: AuthTypes | UseClientDefault | None = USE_CLIENT_DEFAULT,
follow_redirects: bool | UseClientDefault = USE_CLIENT_DEFAULT,
timeout: TimeoutTypes | UseClientDefault = USE_CLIENT_DEFAULT,
extensions: RequestExtensions | None = None,
) -> Response:
...
httpx.AsyncClient's HTTP verbs methods return from the request method and this behaviour isn't overrided by SanicASGITestClient.
That makes Pycharm believe SanicASGITestClient.get's return type is httpx.Response, but it actually is typing.Optional[Request], typing.Optional[TestingResponse].
I believe this might happen to other IDEs as well.
Hello there!
SanicASGITestClientinherits fromhttpx.AsyncClientand override itsrequestmethod, changing its return type.httpx.AsyncClient's HTTP verbs methods return from therequestmethod and this behaviour isn't overrided bySanicASGITestClient.That makes Pycharm believe
SanicASGITestClient.get's return type ishttpx.Response, but it actually istyping.Optional[Request], typing.Optional[TestingResponse].I believe this might happen to other IDEs as well.