1
0
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:
Mariusz Felisiak 2023-09-14 12:44:25 +02:00
parent c35fd9e275
commit 69af3bea99
4 changed files with 2 additions and 27 deletions

View File

@ -5,7 +5,6 @@ import posixpath
import sys
import threading
import unittest
import warnings
from collections import Counter
from contextlib import contextmanager
from copy import copy, deepcopy
@ -51,7 +50,6 @@ from django.test.utils import (
modify_settings,
override_settings,
)
from django.utils.deprecation import RemovedInDjango51Warning
from django.utils.functional import classproperty
from django.views.static import serve
@ -1133,15 +1131,6 @@ class TransactionTestCase(SimpleTestCase):
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):
values = list(values)
items = qs

View File

@ -272,3 +272,5 @@ to remove usage of these features.
removed.
* The ``SimpleTestCase.assertFormsetError()`` method is removed.
* The ``TransactionTestCase.assertQuerysetEqual()`` method is removed.

View File

@ -1874,11 +1874,6 @@ your test suite.
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)
Asserts that when ``func`` is called with ``*args`` and ``**kwargs`` that

View File

@ -39,13 +39,11 @@ from django.test.testcases import DatabaseOperationForbidden
from django.test.utils import (
CaptureQueriesContext,
TestContextDecorator,
ignore_warnings,
isolate_apps,
override_settings,
setup_test_environment,
)
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.version import PY311
@ -266,15 +264,6 @@ class AssertQuerySetEqualTests(TestCase):
cls.p1 = Person.objects.create(name="p1")
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):
self.assertQuerySetEqual(Person.objects.filter(name="p3"), [])