From b5c048f5ecbf1c718102f19c3018b1fb62d66b3d Mon Sep 17 00:00:00 2001 From: Matthias Kestenholz Date: Fri, 9 Aug 2024 17:01:27 +0200 Subject: [PATCH] Refs #35648 -- Added test for addition between SafeString and str in utils_tests. --- tests/utils_tests/test_safestring.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/utils_tests/test_safestring.py b/tests/utils_tests/test_safestring.py index 1a79afbf48..eca32ff8f6 100644 --- a/tests/utils_tests/test_safestring.py +++ b/tests/utils_tests/test_safestring.py @@ -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"), + ("

unsafe

", "a&b<p>unsafe</p>"), + (SafeString("

safe

"), SafeString("a&b

safe

")), + ] + for case, expected in cases: + with self.subTest(case=case): + self.assertRenderEqual("{{ s }}", expected, s=s + case)