summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2021-09-16 09:12:56 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-09-20 21:23:01 +0200
commite2be307b3ab6ebf339b3a765fe64967c9602266f (patch)
treee6a7a2c3d5c463c9ced7e094781f4066b5a19dba /tests
parent75d6c4ae6df93c4c4d8621aced3a180afa18a6cb (diff)
Refs #31235 -- Made assertQuerysetEqual() not call repr() on a queryset when compared to string values.
Per deprecation timeline.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_utils/tests.py31
1 files changed, 2 insertions, 29 deletions
diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py
index 82ec36ab38..ce328cd90a 100644
--- a/tests/test_utils/tests.py
+++ b/tests/test_utils/tests.py
@@ -17,8 +17,8 @@ from django.forms import EmailField, IntegerField
from django.http import HttpResponse
from django.template.loader import render_to_string
from django.test import (
- SimpleTestCase, TestCase, TransactionTestCase, ignore_warnings,
- skipIfDBFeature, skipUnlessDBFeature,
+ SimpleTestCase, TestCase, TransactionTestCase, skipIfDBFeature,
+ skipUnlessDBFeature,
)
from django.test.html import HTMLParseError, parse_html
from django.test.utils import (
@@ -26,7 +26,6 @@ from django.test.utils import (
override_settings, setup_test_environment,
)
from django.urls import NoReverseMatch, path, reverse, reverse_lazy
-from django.utils.deprecation import RemovedInDjango41Warning
from django.utils.log import DEFAULT_LOGGING
from .models import Car, Person, PossessedCar
@@ -362,32 +361,6 @@ class AssertQuerysetEqualTests(TestCase):
self.assertIn(name, exception_msg)
-class AssertQuerysetEqualDeprecationTests(TestCase):
- @classmethod
- def setUpTestData(cls):
- cls.p1 = Person.objects.create(name='p1')
- cls.p2 = Person.objects.create(name='p2')
-
- @ignore_warnings(category=RemovedInDjango41Warning)
- def test_str_values(self):
- self.assertQuerysetEqual(
- Person.objects.all().order_by('name'),
- [repr(self.p1), repr(self.p2)],
- )
-
- def test_str_values_warning(self):
- msg = (
- "In Django 4.1, repr() will not be called automatically on a "
- "queryset when compared to string values. Set an explicit "
- "'transform' to silence this warning."
- )
- with self.assertRaisesMessage(RemovedInDjango41Warning, msg):
- self.assertQuerysetEqual(
- Person.objects.all().order_by('name'),
- [repr(self.p1), repr(self.p2)],
- )
-
-
@override_settings(ROOT_URLCONF='test_utils.urls')
class CaptureQueriesContextManagerTests(TestCase):