From b004bd62e83588fdb0e533fdeec993aec358281d Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sat, 14 Jul 2018 10:38:18 +0200 Subject: Fixed #29412 -- Stopped marking slugify() result as HTML safe. --- tests/utils_tests/test_safestring.py | 6 +----- tests/utils_tests/test_text.py | 3 +++ 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'tests/utils_tests') 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 = [ -- cgit v1.3