mirror of https://github.com/django/django.git
Refs #35648 -- Added test for addition between SafeString and str in utils_tests.
This commit is contained in:
parent
b4c1569eae
commit
b5c048f5ec
|
@ -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&b<p>unsafe</p>"),
|
||||
(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)
|
||||
|
|
Loading…
Reference in New Issue