1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Refs #34609 -- Removed support for calling format_html() without arguments per deprecation timeline.

This commit is contained in:
Sarah Boyce
2024-12-12 17:01:49 +01:00
parent 8081557508
commit 1e331911a8
4 changed files with 6 additions and 21 deletions

View File

@@ -4,7 +4,6 @@ from datetime import datetime
from django.core.exceptions import SuspiciousOperation
from django.core.serializers.json import DjangoJSONEncoder
from django.test import SimpleTestCase
from django.utils.deprecation import RemovedInDjango60Warning
from django.utils.functional import lazystr
from django.utils.html import (
conditional_escape,
@@ -69,14 +68,10 @@ class TestUtilsHtml(SimpleTestCase):
)
def test_format_html_no_params(self):
msg = "Calling format_html() without passing args or kwargs is deprecated."
# RemovedInDjango60Warning: when the deprecation ends, replace with:
# msg = "args or kwargs must be provided."
# with self.assertRaisesMessage(TypeError, msg):
with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
msg = "args or kwargs must be provided."
with self.assertRaisesMessage(TypeError, msg):
name = "Adam"
self.assertEqual(format_html(f"<i>{name}</i>"), "<i>Adam</i>")
self.assertEqual(ctx.filename, __file__)
def test_format_html_join_with_positional_arguments(self):
self.assertEqual(