mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-16 00:37:11 +08:00
fix tests for mypy 0.900 (#641)
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user