From 69af3bea9987044c944b5bc83e32c35f0a73c6dd Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Thu, 14 Sep 2023 12:44:25 +0200 Subject: [PATCH] Refs #33990 -- Removed TransactionTestCase.assertQuerysetEqual() per deprecation timeline. --- django/test/testcases.py | 11 ----------- docs/releases/5.1.txt | 2 ++ docs/topics/testing/tools.txt | 5 ----- tests/test_utils/tests.py | 11 ----------- 4 files changed, 2 insertions(+), 27 deletions(-) diff --git a/django/test/testcases.py b/django/test/testcases.py index a39a38a7d5..8855c7adc5 100644 --- a/django/test/testcases.py +++ b/django/test/testcases.py @@ -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 diff --git a/docs/releases/5.1.txt b/docs/releases/5.1.txt index c3b2a737fa..4ed51d288e 100644 --- a/docs/releases/5.1.txt +++ b/docs/releases/5.1.txt @@ -272,3 +272,5 @@ to remove usage of these features. removed. * The ``SimpleTestCase.assertFormsetError()`` method is removed. + +* The ``TransactionTestCase.assertQuerysetEqual()`` method is removed. diff --git a/docs/topics/testing/tools.txt b/docs/topics/testing/tools.txt index 7190c73d79..b8d44a3237 100644 --- a/docs/topics/testing/tools.txt +++ b/docs/topics/testing/tools.txt @@ -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 diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py index ef72fb9fdb..f05b1f1e71 100644 --- a/tests/test_utils/tests.py +++ b/tests/test_utils/tests.py @@ -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"), [])