Refs #35648 -- Added test for addition between SafeString and str in utils_tests.

This commit is contained in:
Matthias Kestenholz 2024-08-09 17:01:27 +02:00 committed by nessita
parent b4c1569eae
commit b5c048f5ec
1 changed files with 11 additions and 0 deletions

View File

@ -121,3 +121,14 @@ class SafeStringTest(SimpleTestCase):
msg = "object has no attribute 'dynamic_attr'"
with self.assertRaisesMessage(AttributeError, msg):
s.dynamic_attr = True
def test_add_str(self):
s = SafeString("a&b")
cases = [
("test", "a&btest"),
("<p>unsafe</p>", "a&amp;b&lt;p&gt;unsafe&lt;/p&gt;"),
(SafeString("<p>safe</p>"), SafeString("a&b<p>safe</p>")),
]
for case, expected in cases:
with self.subTest(case=case):
self.assertRenderEqual("{{ s }}", expected, s=s + case)