Skip to content

Commit

Permalink
Support ValuesQuerySet in assertQuerySetEqual
Browse files Browse the repository at this point in the history
  • Loading branch information
ziima committed Sep 25, 2023
1 parent e268304 commit fdf6c61
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion django-stubs/test/testcases.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ from django.core.servers.basehttp import ThreadedWSGIServer, WSGIRequestHandler
from django.db import connections as connections # noqa: F401
from django.db.backends.sqlite3.base import DatabaseWrapper
from django.db.models import Model
from django.db.models.query import _BaseQuerySet
from django.db.models.query import _BaseQuerySet, ValuesQuerySet
from django.forms.fields import EmailField
from django.http.response import HttpResponse, HttpResponseBase
from django.template.base import Template
Expand Down Expand Up @@ -165,13 +165,15 @@ class SimpleTestCase(unittest.TestCase):

_T = TypeVar("_T")
_M = TypeVar("_M", bound=Model)
_R = TypeVar("_R")

class TransactionTestCase(SimpleTestCase):
reset_sequences: bool = ...
available_apps: Any = ...
fixtures: Any = ...
multi_db: bool = ...
serialized_rollback: bool = ...
@overload
def assertQuerySetEqual(
self,
qs: _BaseQuerySet[_M],
Expand All @@ -180,7 +182,17 @@ class TransactionTestCase(SimpleTestCase):
ordered: bool = ...,
msg: str | None = ...,
) -> None: ...
@overload
def assertQuerySetEqual( # pyright: ignore[reportOverlappingOverload]
self,
qs: ValuesQuerySet[_M, _R],
values: Iterable[_T],
transform: Callable[[_R], _T] = ...,
ordered: bool = ...,
msg: str | None = ...,
) -> None: ...
# Deprecated alias to assertQuerySetEqual
@overload
def assertQuerysetEqual(
self,
qs: _BaseQuerySet[_M],
Expand All @@ -190,6 +202,15 @@ class TransactionTestCase(SimpleTestCase):
msg: str | None = ...,
) -> None: ...
@overload
def assertQuerysetEqual( # pyright: ignore[reportOverlappingOverload]
self,
qs: ValuesQuerySet[_M, _R],
values: Iterable[_T],
transform: Callable[[_R], _T] = ...,
ordered: bool = ...,
msg: str | None = ...,
) -> None: ...
@overload
def assertNumQueries(
self,
num: int,
Expand Down

0 comments on commit fdf6c61

Please sign in to comment.