瀏覽代碼

Refs #33990 -- Removed TransactionTestCase.assertQuerysetEqual() per deprecation timeline.

Mariusz Felisiak 1 年之前
父節點
當前提交
69af3bea99
共有 4 個文件被更改,包括 2 次插入27 次删除
  1. 0 11
      django/test/testcases.py
  2. 2 0
      docs/releases/5.1.txt
  3. 0 5
      docs/topics/testing/tools.txt
  4. 0 11
      tests/test_utils/tests.py

+ 0 - 11
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

+ 2 - 0
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.

+ 0 - 5
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

+ 0 - 11
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"), [])