Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TransactionTestCase.assertQuerySetEqual #189

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions django-stubs/test/testcases.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import threading
import unittest
from collections.abc import Callable, Iterable
from typing import Any, ClassVar, overload
from typing import Any, ClassVar, TypeVar, overload

from django.core.exceptions import ImproperlyConfigured
from django.core.handlers.wsgi import WSGIHandler
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.forms.fields import EmailField
from django.http.response import HttpResponse, HttpResponseBase
Expand Down Expand Up @@ -162,17 +163,29 @@ class SimpleTestCase(unittest.TestCase):
self, xml1: str, xml2: str, msg: str | None = ...
) -> None: ...

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

class TransactionTestCase(SimpleTestCase):
reset_sequences: bool = ...
available_apps: Any = ...
fixtures: Any = ...
multi_db: bool = ...
serialized_rollback: bool = ...
def assertQuerySetEqual(
self,
qs: _BaseQuerySet[_M],
values: Iterable[_T],
transform: Callable[[_M], _T] = ...,
ordered: bool = ...,
msg: str | None = ...,
) -> None: ...
# Deprecated alias to assertQuerySetEqual
def assertQuerysetEqual(
self,
qs: _BaseQuerySet[Any],
values: Iterable[Any],
transform: Callable[..., Any] | type[str] = ...,
qs: _BaseQuerySet[_M],
values: Iterable[_T],
transform: Callable[[_M], _T] = ...,
ordered: bool = ...,
msg: str | None = ...,
) -> None: ...
Expand Down