summaryrefslogtreecommitdiff
path: root/tests/utils_tests/test_text.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2019-04-24 06:10:28 -0700
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-05-08 08:00:59 +0200
commitb915b9f10f1110bf6b8468060ce9753ff78ffb07 (patch)
tree3551135abdf36f1e3fbf0f4f3d1d73ecec4f5a86 /tests/utils_tests/test_text.py
parent6b736dd0747dc77473f1f7b691c196ef5912d7dd (diff)
Refs #27753 -- Deprecated django.utils.text.unescape_entities().
The function was undocumented and only required for compatibility with Python 2. Code should use Python's html.unescape() that was added in Python 3.4.
Diffstat (limited to 'tests/utils_tests/test_text.py')
-rw-r--r--tests/utils_tests/test_text.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/utils_tests/test_text.py b/tests/utils_tests/test_text.py
index 2d584c1cdd..ee04f3062c 100644
--- a/tests/utils_tests/test_text.py
+++ b/tests/utils_tests/test_text.py
@@ -1,8 +1,9 @@
import json
import sys
-from django.test import SimpleTestCase
+from django.test import SimpleTestCase, ignore_warnings
from django.utils import text
+from django.utils.deprecation import RemovedInDjango40Warning
from django.utils.functional import lazystr
from django.utils.text import format_lazy
from django.utils.translation import gettext_lazy, override
@@ -184,6 +185,7 @@ class TestUtilsText(SimpleTestCase):
# interning the result may be useful, e.g. when fed to Path.
self.assertEqual(sys.intern(text.slugify('a')), 'a')
+ @ignore_warnings(category=RemovedInDjango40Warning)
def test_unescape_entities(self):
items = [
('', ''),
@@ -200,6 +202,14 @@ class TestUtilsText(SimpleTestCase):
self.assertEqual(text.unescape_entities(value), output)
self.assertEqual(text.unescape_entities(lazystr(value)), output)
+ def test_unescape_entities_deprecated(self):
+ msg = (
+ 'django.utils.text.unescape_entities() is deprecated in favor of '
+ 'html.unescape().'
+ )
+ with self.assertWarnsMessage(RemovedInDjango40Warning, msg):
+ text.unescape_entities('foo')
+
def test_unescape_string_literal(self):
items = [
('"abc"', 'abc'),