diff options
| author | Claude Paroz <claude@2xlibre.net> | 2016-12-29 16:27:49 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2017-01-18 20:18:46 +0100 |
| commit | 7b2f2e74adb36a4334e83130f6abc2f79d395235 (patch) | |
| tree | 313387ba6a6f1311b43cf5fb4f2576d2d6c4f805 /tests/utils_tests | |
| parent | f6acd1d271122d66de8061e75ae26137ddf02658 (diff) | |
Refs #23919 -- Removed six.<various>_types usage
Thanks Tim Graham and Simon Charette for the reviews.
Diffstat (limited to 'tests/utils_tests')
| -rw-r--r-- | tests/utils_tests/test_encoding.py | 3 | ||||
| -rw-r--r-- | tests/utils_tests/test_functional.py | 7 | ||||
| -rw-r--r-- | tests/utils_tests/test_lazyobject.py | 2 | ||||
| -rw-r--r-- | tests/utils_tests/test_safestring.py | 4 | ||||
| -rw-r--r-- | tests/utils_tests/test_text.py | 3 |
5 files changed, 8 insertions, 11 deletions
diff --git a/tests/utils_tests/test_encoding.py b/tests/utils_tests/test_encoding.py index b4e7b9c0ac..faf30a59c0 100644 --- a/tests/utils_tests/test_encoding.py +++ b/tests/utils_tests/test_encoding.py @@ -1,7 +1,6 @@ import datetime import unittest -from django.utils import six from django.utils.encoding import ( escape_uri_path, filepath_to_uri, force_bytes, force_text, iri_to_uri, smart_text, uri_to_iri, @@ -27,7 +26,7 @@ class TestEncodingUtils(unittest.TestCase): def test_force_text_lazy(self): s = SimpleLazyObject(lambda: 'x') - self.assertTrue(issubclass(type(force_text(s)), six.text_type)) + self.assertTrue(issubclass(type(force_text(s)), str)) def test_force_bytes_exception(self): """ diff --git a/tests/utils_tests/test_functional.py b/tests/utils_tests/test_functional.py index 0ca534445f..f53e212f93 100644 --- a/tests/utils_tests/test_functional.py +++ b/tests/utils_tests/test_functional.py @@ -1,6 +1,5 @@ import unittest -from django.utils import six from django.utils.functional import cached_property, lazy @@ -45,8 +44,8 @@ class FunctionalTestCase(unittest.TestCase): return b"\xc3\x8e am \xc4\x81 binary \xc7\xa8l\xc3\xa2zz." t = lazy(lambda: Klazz(), Klazz)() - self.assertEqual(six.text_type(t), "Î am ā Ǩlâzz.") - self.assertEqual(six.binary_type(t), b"\xc3\x8e am \xc4\x81 binary \xc7\xa8l\xc3\xa2zz.") + self.assertEqual(str(t), "Î am ā Ǩlâzz.") + self.assertEqual(bytes(t), b"\xc3\x8e am \xc4\x81 binary \xc7\xa8l\xc3\xa2zz.") def test_cached_property(self): """ @@ -99,7 +98,7 @@ class FunctionalTestCase(unittest.TestCase): def test_lazy_repr_text(self): original_object = 'Lazy translation text' - lazy_obj = lazy(lambda: original_object, six.text_type) + lazy_obj = lazy(lambda: original_object, str) self.assertEqual(repr(original_object), repr(lazy_obj())) def test_lazy_repr_int(self): diff --git a/tests/utils_tests/test_lazyobject.py b/tests/utils_tests/test_lazyobject.py index 588e85afc5..8c9b997b3c 100644 --- a/tests/utils_tests/test_lazyobject.py +++ b/tests/utils_tests/test_lazyobject.py @@ -73,7 +73,7 @@ class LazyObjectTestCase(TestCase): def test_text(self): obj = self.lazy_wrap('foo') - self.assertEqual(six.text_type(obj), 'foo') + self.assertEqual(str(obj), 'foo') def test_bool(self): # Refs #21840 diff --git a/tests/utils_tests/test_safestring.py b/tests/utils_tests/test_safestring.py index 96f42d5ddd..9e99b6e20b 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, six, text +from django.utils import html, text from django.utils.encoding import force_bytes from django.utils.functional import lazy, lazystr from django.utils.safestring import SafeData, mark_safe @@ -8,7 +8,7 @@ from django.utils.safestring import SafeData, mark_safe lazybytes = lazy(force_bytes, bytes) -class customescape(six.text_type): +class customescape(str): def __html__(self): # implement specific and obviously wrong escaping # in order to be able to tell for sure when it runs diff --git a/tests/utils_tests/test_text.py b/tests/utils_tests/test_text.py index 9128fb0247..22695277a4 100644 --- a/tests/utils_tests/test_text.py +++ b/tests/utils_tests/test_text.py @@ -1,7 +1,7 @@ import json from django.test import SimpleTestCase -from django.utils import six, text +from django.utils import text from django.utils.functional import lazystr from django.utils.text import format_lazy from django.utils.translation import override, ugettext_lazy @@ -161,7 +161,6 @@ class TestUtilsText(SimpleTestCase): """normalize_newlines should be able to handle bytes too""" normalized = text.normalize_newlines(b"abc\ndef\rghi\r\n") self.assertEqual(normalized, "abc\ndef\nghi\n") - self.assertIsInstance(normalized, six.text_type) def test_phone2numeric(self): numeric = text.phone2numeric('0800 flowers') |
