diff --git a/tests/admin_utils/test_logentry.py b/tests/admin_utils/test_logentry.py index 1cf0de349d..64ff5fec3e 100644 --- a/tests/admin_utils/test_logentry.py +++ b/tests/admin_utils/test_logentry.py @@ -8,7 +8,6 @@ from django.contrib.contenttypes.models import ContentType from django.test import TestCase, override_settings from django.urls import reverse from django.utils import translation -from django.utils.encoding import force_bytes from django.utils.html import escape from .models import Article, ArticleProxy, Site @@ -211,9 +210,10 @@ class LogEntryTests(TestCase): logentry.content_type = None logentry.save() - counted_presence_before = response.content.count(force_bytes(should_contain)) + should_contain = should_contain.encode() + counted_presence_before = response.content.count(should_contain) response = self.client.get(reverse('admin:index')) - counted_presence_after = response.content.count(force_bytes(should_contain)) + counted_presence_after = response.content.count(should_contain) self.assertEqual(counted_presence_before - 1, counted_presence_after) def test_proxy_model_content_type_is_used_for_log_entries(self): diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index 68094e0053..3089307ba2 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -29,7 +29,7 @@ from django.test.utils import override_script_prefix, patch_logger from django.urls import NoReverseMatch, resolve, reverse from django.utils import formats, translation from django.utils.cache import get_max_age -from django.utils.encoding import force_bytes, force_text, iri_to_uri +from django.utils.encoding import iri_to_uri from django.utils.html import escape from django.utils.http import urlencode @@ -183,8 +183,8 @@ class AdminViewBasicTestCase(TestCase): """ self.assertEqual(response.status_code, 200) self.assertLess( - response.content.index(force_bytes(text1)), - response.content.index(force_bytes(text2)), + response.content.index(text1.encode()), + response.content.index(text2.encode()), (failing_msg or '') + '\nResponse:\n' + response.content.decode(response.charset) ) @@ -2161,16 +2161,14 @@ class AdminViewDeletedObjectsTest(TestCase): cause them to be scheduled for deletion. """ pattern = re.compile( - force_bytes( - r'