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/template_tests | |
| parent | f6acd1d271122d66de8061e75ae26137ddf02658 (diff) | |
Refs #23919 -- Removed six.<various>_types usage
Thanks Tim Graham and Simon Charette for the reviews.
Diffstat (limited to 'tests/template_tests')
| -rw-r--r-- | tests/template_tests/filter_tests/test_escape.py | 3 | ||||
| -rw-r--r-- | tests/template_tests/filter_tests/test_escapejs.py | 3 | ||||
| -rw-r--r-- | tests/template_tests/filter_tests/test_floatformat.py | 7 | ||||
| -rw-r--r-- | tests/template_tests/filter_tests/test_linebreaks.py | 3 | ||||
| -rw-r--r-- | tests/template_tests/filter_tests/test_slugify.py | 3 | ||||
| -rw-r--r-- | tests/template_tests/filter_tests/test_urlize.py | 3 | ||||
| -rw-r--r-- | tests/template_tests/templatetags/custom.py | 6 | ||||
| -rw-r--r-- | tests/template_tests/templatetags/inclusion.py | 10 | ||||
| -rw-r--r-- | tests/template_tests/test_unicode.py | 3 |
9 files changed, 17 insertions, 24 deletions
diff --git a/tests/template_tests/filter_tests/test_escape.py b/tests/template_tests/filter_tests/test_escape.py index 6f28b972a2..22d5ca7d55 100644 --- a/tests/template_tests/filter_tests/test_escape.py +++ b/tests/template_tests/filter_tests/test_escape.py @@ -1,6 +1,5 @@ from django.template.defaultfilters import escape from django.test import SimpleTestCase -from django.utils import six from django.utils.functional import Promise, lazy from django.utils.safestring import mark_safe @@ -34,7 +33,7 @@ class EscapeTests(SimpleTestCase): self.assertEqual(output, "x&y") def test_escape_lazy_string(self): - add_html = lazy(lambda string: string + 'special characters > here', six.text_type) + add_html = lazy(lambda string: string + 'special characters > here', str) escaped = escape(add_html('<some html & ')) self.assertIsInstance(escaped, Promise) self.assertEqual(escaped, '<some html & special characters > here') diff --git a/tests/template_tests/filter_tests/test_escapejs.py b/tests/template_tests/filter_tests/test_escapejs.py index 3b038726b2..9aa98819e1 100644 --- a/tests/template_tests/filter_tests/test_escapejs.py +++ b/tests/template_tests/filter_tests/test_escapejs.py @@ -1,6 +1,5 @@ from django.template.defaultfilters import escapejs_filter from django.test import SimpleTestCase -from django.utils import six from django.utils.functional import lazy from ..utils import setup @@ -53,7 +52,7 @@ class FunctionTests(SimpleTestCase): ) def test_lazy_string(self): - append_script = lazy(lambda string: r'<script>this</script>' + string, six.text_type) + append_script = lazy(lambda string: r'<script>this</script>' + string, str) self.assertEqual( escapejs_filter(append_script('whitespace: \r\n\t\v\f\b')), '\\u003Cscript\\u003Ethis\\u003C/script\\u003E' diff --git a/tests/template_tests/filter_tests/test_floatformat.py b/tests/template_tests/filter_tests/test_floatformat.py index d4a4526d1d..8474238f21 100644 --- a/tests/template_tests/filter_tests/test_floatformat.py +++ b/tests/template_tests/filter_tests/test_floatformat.py @@ -2,7 +2,6 @@ from decimal import Decimal, localcontext from django.template.defaultfilters import floatformat from django.test import SimpleTestCase -from django.utils import six from django.utils.safestring import mark_safe from ..utils import setup @@ -64,13 +63,13 @@ class FunctionTests(SimpleTestCase): def test_infinity(self): pos_inf = float(1e30000) - self.assertEqual(floatformat(pos_inf), six.text_type(pos_inf)) + self.assertEqual(floatformat(pos_inf), str(pos_inf)) neg_inf = float(-1e30000) - self.assertEqual(floatformat(neg_inf), six.text_type(neg_inf)) + self.assertEqual(floatformat(neg_inf), str(neg_inf)) nan = pos_inf / pos_inf - self.assertEqual(floatformat(nan), six.text_type(nan)) + self.assertEqual(floatformat(nan), str(nan)) def test_float_dunder_method(self): class FloatWrapper(object): diff --git a/tests/template_tests/filter_tests/test_linebreaks.py b/tests/template_tests/filter_tests/test_linebreaks.py index 50a66f3c47..0f3cd7a117 100644 --- a/tests/template_tests/filter_tests/test_linebreaks.py +++ b/tests/template_tests/filter_tests/test_linebreaks.py @@ -1,6 +1,5 @@ from django.template.defaultfilters import linebreaks_filter from django.test import SimpleTestCase -from django.utils import six from django.utils.functional import lazy from django.utils.safestring import mark_safe @@ -54,7 +53,7 @@ class FunctionTests(SimpleTestCase): ) def test_lazy_string_input(self): - add_header = lazy(lambda string: 'Header\n\n' + string, six.text_type) + add_header = lazy(lambda string: 'Header\n\n' + string, str) self.assertEqual( linebreaks_filter(add_header('line 1\r\nline2')), '<p>Header</p>\n\n<p>line 1<br />line2</p>' diff --git a/tests/template_tests/filter_tests/test_slugify.py b/tests/template_tests/filter_tests/test_slugify.py index ec9f2bb736..cb23e9b320 100644 --- a/tests/template_tests/filter_tests/test_slugify.py +++ b/tests/template_tests/filter_tests/test_slugify.py @@ -1,6 +1,5 @@ from django.template.defaultfilters import slugify from django.test import SimpleTestCase -from django.utils import six from django.utils.encoding import force_text from django.utils.functional import lazy from django.utils.safestring import mark_safe @@ -43,7 +42,7 @@ class FunctionTests(SimpleTestCase): self.assertEqual(slugify(123), '123') def test_slugify_lazy_string(self): - lazy_str = lazy(lambda string: force_text(string), six.text_type) + lazy_str = lazy(lambda string: force_text(string), str) self.assertEqual( slugify(lazy_str(' Jack & Jill like numbers 1,2,3 and 4 and silly characters ?%.$!/')), 'jack-jill-like-numbers-123-and-4-and-silly-characters', diff --git a/tests/template_tests/filter_tests/test_urlize.py b/tests/template_tests/filter_tests/test_urlize.py index 3096213a22..2bf94126d4 100644 --- a/tests/template_tests/filter_tests/test_urlize.py +++ b/tests/template_tests/filter_tests/test_urlize.py @@ -1,6 +1,5 @@ from django.template.defaultfilters import urlize from django.test import SimpleTestCase -from django.utils import six from django.utils.functional import lazy from django.utils.safestring import mark_safe @@ -367,7 +366,7 @@ class FunctionTests(SimpleTestCase): ) def test_lazystring(self): - prepend_www = lazy(lambda url: 'www.' + url, six.text_type) + prepend_www = lazy(lambda url: 'www.' + url, str) self.assertEqual( urlize(prepend_www('google.com')), '<a href="http://www.google.com" rel="nofollow">www.google.com</a>', diff --git a/tests/template_tests/templatetags/custom.py b/tests/template_tests/templatetags/custom.py index 3c3e4ce8ed..363e7094ce 100644 --- a/tests/template_tests/templatetags/custom.py +++ b/tests/template_tests/templatetags/custom.py @@ -94,7 +94,7 @@ simple_one_default.anything = "Expected simple_one_default __dict__" def simple_unlimited_args(one, two='hi', *args): """Expected simple_unlimited_args __doc__""" return "simple_unlimited_args - Expected result: %s" % ( - ', '.join(six.text_type(arg) for arg in [one, two] + list(args)) + ', '.join(str(arg) for arg in [one, two] + list(args)) ) @@ -104,7 +104,7 @@ simple_unlimited_args.anything = "Expected simple_unlimited_args __dict__" @register.simple_tag def simple_only_unlimited_args(*args): """Expected simple_only_unlimited_args __doc__""" - return "simple_only_unlimited_args - Expected result: %s" % ', '.join(six.text_type(arg) for arg in args) + return "simple_only_unlimited_args - Expected result: %s" % ', '.join(str(arg) for arg in args) simple_only_unlimited_args.anything = "Expected simple_only_unlimited_args __dict__" @@ -116,7 +116,7 @@ def simple_unlimited_args_kwargs(one, two='hi', *args, **kwargs): # Sort the dictionary by key to guarantee the order for testing. sorted_kwarg = sorted(six.iteritems(kwargs), key=operator.itemgetter(0)) return "simple_unlimited_args_kwargs - Expected result: %s / %s" % ( - ', '.join(six.text_type(arg) for arg in [one, two] + list(args)), + ', '.join(str(arg) for arg in [one, two] + list(args)), ', '.join('%s=%s' % (k, v) for (k, v) in sorted_kwarg) ) diff --git a/tests/template_tests/templatetags/inclusion.py b/tests/template_tests/templatetags/inclusion.py index dbdfa45c95..745dd7ffae 100644 --- a/tests/template_tests/templatetags/inclusion.py +++ b/tests/template_tests/templatetags/inclusion.py @@ -152,7 +152,7 @@ def inclusion_unlimited_args(one, two='hi', *args): return { "result": ( "inclusion_unlimited_args - Expected result: %s" % ( - ', '.join(six.text_type(arg) for arg in [one, two] + list(args)) + ', '.join(str(arg) for arg in [one, two] + list(args)) ) ) } @@ -167,7 +167,7 @@ def inclusion_unlimited_args_from_template(one, two='hi', *args): return { "result": ( "inclusion_unlimited_args_from_template - Expected result: %s" % ( - ', '.join(six.text_type(arg) for arg in [one, two] + list(args)) + ', '.join(str(arg) for arg in [one, two] + list(args)) ) ) } @@ -181,7 +181,7 @@ def inclusion_only_unlimited_args(*args): """Expected inclusion_only_unlimited_args __doc__""" return { "result": "inclusion_only_unlimited_args - Expected result: %s" % ( - ', '.join(six.text_type(arg) for arg in args) + ', '.join(str(arg) for arg in args) ) } @@ -194,7 +194,7 @@ def inclusion_only_unlimited_args_from_template(*args): """Expected inclusion_only_unlimited_args_from_template __doc__""" return { "result": "inclusion_only_unlimited_args_from_template - Expected result: %s" % ( - ', '.join(six.text_type(arg) for arg in args) + ', '.join(str(arg) for arg in args) ) } @@ -217,7 +217,7 @@ def inclusion_unlimited_args_kwargs(one, two='hi', *args, **kwargs): # Sort the dictionary by key to guarantee the order for testing. sorted_kwarg = sorted(six.iteritems(kwargs), key=operator.itemgetter(0)) return {"result": "inclusion_unlimited_args_kwargs - Expected result: %s / %s" % ( - ', '.join(six.text_type(arg) for arg in [one, two] + list(args)), + ', '.join(str(arg) for arg in [one, two] + list(args)), ', '.join('%s=%s' % (k, v) for (k, v) in sorted_kwarg) )} diff --git a/tests/template_tests/test_unicode.py b/tests/template_tests/test_unicode.py index f6471e72e0..dbd18eb495 100644 --- a/tests/template_tests/test_unicode.py +++ b/tests/template_tests/test_unicode.py @@ -2,7 +2,6 @@ from unittest import TestCase from django.template import Context, Engine from django.template.base import TemplateEncodingError -from django.utils import six from django.utils.safestring import SafeData @@ -28,5 +27,5 @@ class UnicodeTests(TestCase): # they all render the same (and are returned as unicode objects and # "safe" objects as well, for auto-escaping purposes). self.assertEqual(t1.render(c3), t2.render(c3)) - self.assertIsInstance(t1.render(c3), six.text_type) + self.assertIsInstance(t1.render(c3), str) self.assertIsInstance(t1.render(c3), SafeData) |
