mirror of
https://github.com/django/django.git
synced 2025-01-03 15:06:09 +00:00
Refs #33990 -- Removed TransactionTestCase.assertQuerysetEqual() per deprecation timeline.
This commit is contained in:
parent
c35fd9e275
commit
69af3bea99
@ -5,7 +5,6 @@ import posixpath
|
|||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import unittest
|
import unittest
|
||||||
import warnings
|
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from copy import copy, deepcopy
|
from copy import copy, deepcopy
|
||||||
@ -51,7 +50,6 @@ from django.test.utils import (
|
|||||||
modify_settings,
|
modify_settings,
|
||||||
override_settings,
|
override_settings,
|
||||||
)
|
)
|
||||||
from django.utils.deprecation import RemovedInDjango51Warning
|
|
||||||
from django.utils.functional import classproperty
|
from django.utils.functional import classproperty
|
||||||
from django.views.static import serve
|
from django.views.static import serve
|
||||||
|
|
||||||
@ -1133,15 +1131,6 @@ class TransactionTestCase(SimpleTestCase):
|
|||||||
inhibit_post_migrate=inhibit_post_migrate,
|
inhibit_post_migrate=inhibit_post_migrate,
|
||||||
)
|
)
|
||||||
|
|
||||||
# RemovedInDjango51Warning.
|
|
||||||
def assertQuerysetEqual(self, *args, **kw):
|
|
||||||
warnings.warn(
|
|
||||||
"assertQuerysetEqual() is deprecated in favor of assertQuerySetEqual().",
|
|
||||||
category=RemovedInDjango51Warning,
|
|
||||||
stacklevel=2,
|
|
||||||
)
|
|
||||||
return self.assertQuerySetEqual(*args, **kw)
|
|
||||||
|
|
||||||
def assertQuerySetEqual(self, qs, values, transform=None, ordered=True, msg=None):
|
def assertQuerySetEqual(self, qs, values, transform=None, ordered=True, msg=None):
|
||||||
values = list(values)
|
values = list(values)
|
||||||
items = qs
|
items = qs
|
||||||
|
@ -272,3 +272,5 @@ to remove usage of these features.
|
|||||||
removed.
|
removed.
|
||||||
|
|
||||||
* The ``SimpleTestCase.assertFormsetError()`` method is removed.
|
* The ``SimpleTestCase.assertFormsetError()`` method is removed.
|
||||||
|
|
||||||
|
* The ``TransactionTestCase.assertQuerysetEqual()`` method is removed.
|
||||||
|
@ -1874,11 +1874,6 @@ your test suite.
|
|||||||
|
|
||||||
Output in case of error can be customized with the ``msg`` argument.
|
Output in case of error can be customized with the ``msg`` argument.
|
||||||
|
|
||||||
.. deprecated:: 4.2
|
|
||||||
|
|
||||||
The ``assertQuerysetEqual()`` assertion method is deprecated. Use
|
|
||||||
``assertQuerySetEqual()`` instead.
|
|
||||||
|
|
||||||
.. method:: TransactionTestCase.assertNumQueries(num, func, *args, **kwargs)
|
.. method:: TransactionTestCase.assertNumQueries(num, func, *args, **kwargs)
|
||||||
|
|
||||||
Asserts that when ``func`` is called with ``*args`` and ``**kwargs`` that
|
Asserts that when ``func`` is called with ``*args`` and ``**kwargs`` that
|
||||||
|
@ -39,13 +39,11 @@ from django.test.testcases import DatabaseOperationForbidden
|
|||||||
from django.test.utils import (
|
from django.test.utils import (
|
||||||
CaptureQueriesContext,
|
CaptureQueriesContext,
|
||||||
TestContextDecorator,
|
TestContextDecorator,
|
||||||
ignore_warnings,
|
|
||||||
isolate_apps,
|
isolate_apps,
|
||||||
override_settings,
|
override_settings,
|
||||||
setup_test_environment,
|
setup_test_environment,
|
||||||
)
|
)
|
||||||
from django.urls import NoReverseMatch, path, reverse, reverse_lazy
|
from django.urls import NoReverseMatch, path, reverse, reverse_lazy
|
||||||
from django.utils.deprecation import RemovedInDjango51Warning
|
|
||||||
from django.utils.html import VOID_ELEMENTS
|
from django.utils.html import VOID_ELEMENTS
|
||||||
from django.utils.version import PY311
|
from django.utils.version import PY311
|
||||||
|
|
||||||
@ -266,15 +264,6 @@ class AssertQuerySetEqualTests(TestCase):
|
|||||||
cls.p1 = Person.objects.create(name="p1")
|
cls.p1 = Person.objects.create(name="p1")
|
||||||
cls.p2 = Person.objects.create(name="p2")
|
cls.p2 = Person.objects.create(name="p2")
|
||||||
|
|
||||||
def test_rename_assertquerysetequal_deprecation_warning(self):
|
|
||||||
msg = "assertQuerysetEqual() is deprecated in favor of assertQuerySetEqual()."
|
|
||||||
with self.assertRaisesMessage(RemovedInDjango51Warning, msg):
|
|
||||||
self.assertQuerysetEqual()
|
|
||||||
|
|
||||||
@ignore_warnings(category=RemovedInDjango51Warning)
|
|
||||||
def test_deprecated_assertquerysetequal(self):
|
|
||||||
self.assertQuerysetEqual(Person.objects.filter(name="p3"), [])
|
|
||||||
|
|
||||||
def test_empty(self):
|
def test_empty(self):
|
||||||
self.assertQuerySetEqual(Person.objects.filter(name="p3"), [])
|
self.assertQuerySetEqual(Person.objects.filter(name="p3"), [])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user