diff options
| author | devilsautumn <bhuvnesh875@gmail.com> | 2023-06-06 14:26:53 +0530 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-06-06 14:14:57 +0200 |
| commit | 094b0bea2ce76db9d3dc06c384d4ac3b22705810 (patch) | |
| tree | 3a6745cd3020b7e91c2d0ebd905b6327a7b0cea8 /tests/utils_tests/test_html.py | |
| parent | 4f6a51dfe6a4a8d5ed61c73b902e808109f142b0 (diff) | |
Fixed #34609 -- Deprecated calling format_html() without arguments.
Diffstat (limited to 'tests/utils_tests/test_html.py')
| -rw-r--r-- | tests/utils_tests/test_html.py | 10 |
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): "< Dangerous > <b>safe</b> < 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>"), |
