diff options
| author | Matthias Kestenholz <mk@feinheit.ch> | 2024-08-09 17:01:27 +0200 |
|---|---|---|
| committer | nessita <124304+nessita@users.noreply.github.com> | 2024-08-12 14:25:05 -0300 |
| commit | b5c048f5ecbf1c718102f19c3018b1fb62d66b3d (patch) | |
| tree | 7436fa7cc38a3b8d4580aa24fae43391878be592 /tests/utils_tests | |
| parent | b4c1569eae197ab55d02adf82b4ff9a011f9ce53 (diff) | |
Refs #35648 -- Added test for addition between SafeString and str in utils_tests.
Diffstat (limited to 'tests/utils_tests')
| -rw-r--r-- | tests/utils_tests/test_safestring.py | 11 |
1 files changed, 11 insertions, 0 deletions
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"), + ("<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) |
