fix tests for mypy 0.900 (#641)

This commit is contained in:
Cesar Canassa
2021-06-12 00:05:46 +02:00
committed by GitHub
parent 47f1700a8b
commit 77f9926ce1
33 changed files with 370 additions and 369 deletions

View File

@@ -2,12 +2,12 @@
main: |
from django.db import connection
with connection.cursor() as cursor:
reveal_type(cursor) # N: Revealed type is 'django.db.backends.utils.CursorWrapper'
reveal_type(cursor) # N: Revealed type is "django.db.backends.utils.CursorWrapper"
cursor.execute("SELECT %s", [123])
- case: raw_connections
main: |
from django.db import connections
reveal_type(connections["test"]) # N: Revealed type is 'django.db.backends.base.base.BaseDatabaseWrapper'
reveal_type(connections["test"]) # N: Revealed type is "django.db.backends.base.base.BaseDatabaseWrapper"
for connection in connections.all():
with connection.cursor() as cursor:
reveal_type(cursor) # N: Revealed type is 'django.db.backends.utils.CursorWrapper'
reveal_type(cursor) # N: Revealed type is "django.db.backends.utils.CursorWrapper"

View File

@@ -3,19 +3,19 @@
from django.db.transaction import atomic
@atomic
def func(x: int) -> list: ...
reveal_type(func) # N: Revealed type is 'def (x: builtins.int) -> builtins.list[Any]'
reveal_type(func) # N: Revealed type is "def (x: builtins.int) -> builtins.list[Any]"
- case: atomic_args
main: |
from django.db.transaction import atomic
@atomic(using='bla', savepoint=False)
def func(x: int) -> list: ...
reveal_type(func) # N: Revealed type is 'def (x: builtins.int) -> builtins.list[Any]'
reveal_type(func) # N: Revealed type is "def (x: builtins.int) -> builtins.list[Any]"
- case: non_atomic_requests_bare
main: |
from django.db.transaction import non_atomic_requests
@non_atomic_requests
def view_func(request): ...
reveal_type(view_func) # N: Revealed type is 'def (request: Any) -> Any'
reveal_type(view_func) # N: Revealed type is "def (request: Any) -> Any"
- case: non_atomic_requests_args
main: |
@@ -24,5 +24,5 @@
from django.db.transaction import non_atomic_requests
@non_atomic_requests
def view_func(request: HttpRequest, arg: str) -> HttpResponse: ...
reveal_type(view_func) # N: Revealed type is 'def (request: django.http.request.HttpRequest, arg: builtins.str) -> django.http.response.HttpResponse'
reveal_type(view_func) # N: Revealed type is "def (request: django.http.request.HttpRequest, arg: builtins.str) -> django.http.response.HttpResponse"