Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos committed May 15, 2024
1 parent 5e93adb commit 726654a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/typecheck/views/decorators/test_csrf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- case: view_decorator
main: |
from django.http.request import HttpRequest
from django.http.response import HttpResponse
from django.views.decorators.csrf import csrf_protect
@csrf_protect
def good_view(request: HttpRequest) -> HttpResponse:
return HttpResponse()
@csrf_protect
def bad_view(request: int) -> str:
return ""
out: |
main:9: error: Value of type variable "_ViewFuncT" of "csrf_protect" cannot be "Callable[[int], str]" [type-var]

0 comments on commit 726654a

Please sign in to comment.