summaryrefslogtreecommitdiff
path: root/tests/utils_tests/test_html.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/utils_tests/test_html.py')
-rw-r--r--tests/utils_tests/test_html.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/utils_tests/test_html.py b/tests/utils_tests/test_html.py
index b7a7396075..ad31b8cc5b 100644
--- a/tests/utils_tests/test_html.py
+++ b/tests/utils_tests/test_html.py
@@ -3,6 +3,7 @@ from datetime import datetime
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,
@@ -65,6 +66,15 @@ class TestUtilsHtml(SimpleTestCase):
"&lt; Dangerous &gt; <b>safe</b> &lt; dangerous again <i>safe again</i>",
)
+ 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(ValueError, msg):
+ with self.assertWarnsMessage(RemovedInDjango60Warning, msg):
+ name = "Adam"
+ self.assertEqual(format_html(f"<i>{name}</i>"), "<i>Adam</i>")
+
def test_linebreaks(self):
items = (
("para1\n\npara2\r\rpara3", "<p>para1</p>\n\n<p>para2</p>\n\n<p>para3</p>"),