diff options
| author | Claude Paroz <claude@2xlibre.net> | 2017-01-26 09:37:07 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2017-01-30 15:04:45 +0100 |
| commit | 52138b1fd08f80fe98def7e22a9693415b4f7744 (patch) | |
| tree | 83a4e3c95bac121d0cc661ed2e637ad99fe322e4 /tests | |
| parent | 277a4dd4b4cc2a2cad77139882f084480751a95a (diff) | |
Refs #23919 -- Removed usage of obsolete SafeBytes class
The class will be removed as part of #27753.
Thanks Tim Graham for the review.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/i18n/tests.py | 4 | ||||
| -rw-r--r-- | tests/utils_tests/test_encoding.py | 4 | ||||
| -rw-r--r-- | tests/utils_tests/test_safestring.py | 7 |
3 files changed, 2 insertions, 13 deletions
diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py index acff0dfc28..d2b878b435 100644 --- a/tests/i18n/tests.py +++ b/tests/i18n/tests.py @@ -20,7 +20,7 @@ from django.utils.formats import ( localize_input, reset_format_cache, sanitize_separators, time_format, ) from django.utils.numberformat import format as nformat -from django.utils.safestring import SafeBytes, SafeText +from django.utils.safestring import SafeText from django.utils.translation import ( LANGUAGE_SESSION_KEY, activate, check_for_language, deactivate, get_language, get_language_from_request, get_language_info, gettext_lazy, @@ -1280,8 +1280,6 @@ class TestModels(TestCase): c = Company(cents_paid=12, products_delivered=1) c.name = SafeText('Iñtërnâtiônàlizætiøn1') c.save() - c.name = SafeBytes('Iñtërnâtiônàlizætiøn1'.encode('utf-8')) - c.save() class TestLanguageInfo(SimpleTestCase): diff --git a/tests/utils_tests/test_encoding.py b/tests/utils_tests/test_encoding.py index ea3b97ddf5..bd937bf960 100644 --- a/tests/utils_tests/test_encoding.py +++ b/tests/utils_tests/test_encoding.py @@ -62,10 +62,6 @@ class TestRFC3987IEncodingUtils(unittest.TestCase): def test_filepath_to_uri(self): self.assertEqual(filepath_to_uri('upload\\чубака.mp4'), 'upload/%D1%87%D1%83%D0%B1%D0%B0%D0%BA%D0%B0.mp4') - self.assertEqual( - filepath_to_uri('upload\\чубака.mp4'.encode('utf-8')), - 'upload/%D1%87%D1%83%D0%B1%D0%B0%D0%BA%D0%B0.mp4' - ) def test_iri_to_uri(self): cases = [ diff --git a/tests/utils_tests/test_safestring.py b/tests/utils_tests/test_safestring.py index d1ef28944e..d7afb38950 100644 --- a/tests/utils_tests/test_safestring.py +++ b/tests/utils_tests/test_safestring.py @@ -1,12 +1,9 @@ from django.template import Context, Template from django.test import SimpleTestCase from django.utils import html, text -from django.utils.encoding import force_bytes -from django.utils.functional import lazy, lazystr +from django.utils.functional import lazystr from django.utils.safestring import SafeData, mark_safe -lazybytes = lazy(force_bytes, bytes) - class customescape(str): def __html__(self): @@ -37,10 +34,8 @@ class SafeStringTest(SimpleTestCase): def test_mark_safe_lazy(self): s = lazystr('a&b') - b = lazybytes(b'a&b') self.assertIsInstance(mark_safe(s), SafeData) - self.assertIsInstance(mark_safe(b), SafeData) self.assertRenderEqual('{{ s }}', 'a&b', s=mark_safe(s)) def test_mark_safe_object_implementing_dunder_str(self): |
