summaryrefslogtreecommitdiff
path: root/tests/utils_tests
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2018-07-14 10:38:18 +0200
committerTim Graham <timograham@gmail.com>2018-07-20 10:44:30 -0400
commitb004bd62e83588fdb0e533fdeec993aec358281d (patch)
tree0752bdad31c3132e1eb96b0a10346b7c394a8910 /tests/utils_tests
parent861638a3074f289faf729d739edf6326332a484f (diff)
Fixed #29412 -- Stopped marking slugify() result as HTML safe.
Diffstat (limited to 'tests/utils_tests')
-rw-r--r--tests/utils_tests/test_safestring.py6
-rw-r--r--tests/utils_tests/test_text.py3
2 files changed, 4 insertions, 5 deletions
diff --git a/tests/utils_tests/test_safestring.py b/tests/utils_tests/test_safestring.py
index bb4dfd1280..b880d19f27 100644
--- a/tests/utils_tests/test_safestring.py
+++ b/tests/utils_tests/test_safestring.py
@@ -1,6 +1,6 @@
from django.template import Context, Template
from django.test import SimpleTestCase
-from django.utils import html, text
+from django.utils import html
from django.utils.functional import lazy, lazystr
from django.utils.safestring import SafeData, mark_safe
@@ -69,10 +69,6 @@ class SafeStringTest(SimpleTestCase):
s += mark_safe('&b')
self.assertRenderEqual('{{ s }}', 'a&b', s=s)
- s = text.slugify(lazystr('a'))
- s += mark_safe('&b')
- self.assertRenderEqual('{{ s }}', 'a&b', s=s)
-
def test_mark_safe_as_decorator(self):
"""
mark_safe used as a decorator leaves the result of a function
diff --git a/tests/utils_tests/test_text.py b/tests/utils_tests/test_text.py
index 693c436eb8..5e12391116 100644
--- a/tests/utils_tests/test_text.py
+++ b/tests/utils_tests/test_text.py
@@ -1,4 +1,5 @@
import json
+import sys
from django.test import SimpleTestCase
from django.utils import text
@@ -179,6 +180,8 @@ class TestUtilsText(SimpleTestCase):
)
for value, output, is_unicode in items:
self.assertEqual(text.slugify(value, allow_unicode=is_unicode), output)
+ # interning the result may be useful, e.g. when fed to Path.
+ self.assertEqual(sys.intern(text.slugify('a')), 'a')
def test_unescape_entities(self):
items = [