summaryrefslogtreecommitdiff
path: root/tests/utils_tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/utils_tests')
-rw-r--r--tests/utils_tests/test_safestring.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/utils_tests/test_safestring.py b/tests/utils_tests/test_safestring.py
index 2eeddb0571..80f31d42ac 100644
--- a/tests/utils_tests/test_safestring.py
+++ b/tests/utils_tests/test_safestring.py
@@ -2,7 +2,7 @@ from django.template import Context, Template
from django.test import SimpleTestCase
from django.utils import html
from django.utils.functional import lazy, lazystr
-from django.utils.safestring import SafeData, mark_safe
+from django.utils.safestring import SafeData, SafeString, mark_safe
class customescape(str):
@@ -98,3 +98,15 @@ class SafeStringTest(SimpleTestCase):
lazy_str = lazy(html_str, str)()
self.assertEqual(mark_safe(lazy_str), html_str())
+
+ def test_default_additional_attrs(self):
+ s = SafeString('a&b')
+ msg = "object has no attribute 'dynamic_attr'"
+ with self.assertRaisesMessage(AttributeError, msg):
+ s.dynamic_attr = True
+
+ def test_default_safe_data_additional_attrs(self):
+ s = SafeData()
+ msg = "object has no attribute 'dynamic_attr'"
+ with self.assertRaisesMessage(AttributeError, msg):
+ s.dynamic_attr = True