django-stubs
django-stubs copied to clipboard
regression in 5.2? cannot extract `rest_framework` `Response` from django test client
Bug report
seems something in 5.2 caused this to break -- here's a minimal example:
from django.test import TestCase
from rest_framework.response import Response
class T(TestCase):
def get_rf_resp(self, url: str) -> Response:
resp = self.client.get(url)
assert isinstance(resp, Response), resp
return resp
What's wrong
$ mypy t3.py --warn-unreachable
t3.py:8: error: Subclass of "_MonkeyPatchedWSGIResponse" and "Response" cannot exist: would have incompatible method signatures [unreachable]
t3.py:9: error: Statement is unreachable [unreachable]
Found 2 errors in 1 file (checked 1 source file)
How is that should be
no errors
System information
- OS:
pythonversion: 3.13.1djangoversion: 5.2.0mypyversion: 1.15.0django-stubsversion: 5.2.0 (forked, but not relevant here)django-stubs-extversion: 5.2.0