Refs #34609 -- Fixed deprecation warning stack level in format_html().

Co-authored-by: Simon Charette <charette.s@gmail.com>
This commit is contained in:
Adam Johnson 2024-08-27 19:14:50 +01:00 committed by GitHub
parent b941de340d
commit 2b71b2c8dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View file

@ -71,10 +71,11 @@ class TestUtilsHtml(SimpleTestCase):
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):
# with self.assertRaisesMessage(TypeError, msg):
with self.assertWarnsMessage(RemovedInDjango60Warning, msg) as ctx:
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(