summaryrefslogtreecommitdiff
path: root/tests/utils_tests/test_encoding.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/utils_tests/test_encoding.py')
-rw-r--r--tests/utils_tests/test_encoding.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/utils_tests/test_encoding.py b/tests/utils_tests/test_encoding.py
index 81024bdf12..9527f29dcf 100644
--- a/tests/utils_tests/test_encoding.py
+++ b/tests/utils_tests/test_encoding.py
@@ -9,6 +9,7 @@ from django.utils.encoding import (
escape_uri_path, filepath_to_uri, force_bytes, force_text, iri_to_uri,
smart_text, uri_to_iri,
)
+from django.utils.functional import SimpleLazyObject
from django.utils.http import urlquote_plus
@@ -28,6 +29,10 @@ class TestEncodingUtils(unittest.TestCase):
exception = TypeError if six.PY3 else UnicodeError
self.assertRaises(exception, force_text, MyString())
+ def test_force_text_lazy(self):
+ s = SimpleLazyObject(lambda: 'x')
+ self.assertTrue(issubclass(type(force_text(s)), six.text_type))
+
def test_force_bytes_exception(self):
"""
Test that force_bytes knows how to convert to bytes an exception