Refs #27795 -- Removed unneeded force_text calls

Thanks Tim Graham for the review.
This commit is contained in:
Claude Paroz 2017-03-04 15:47:49 +01:00
parent 86de930f41
commit 8346680e1c
42 changed files with 75 additions and 132 deletions

View file

@ -635,8 +635,6 @@ class MailTests(HeadersCheckMixin, SimpleTestCase):
# Simple ASCII address - string form
self.assertEqual(sanitize_address('to@example.com', 'ascii'), 'to@example.com')
self.assertEqual(sanitize_address('to@example.com', 'utf-8'), 'to@example.com')
# Bytestrings are transformed to normal strings.
self.assertEqual(sanitize_address(b'to@example.com', 'utf-8'), 'to@example.com')
# Simple ASCII address - tuple form
self.assertEqual(

View file

@ -359,7 +359,7 @@ class StateTests(SimpleTestCase):
# The ordering we really want is objects, mgr1, mgr2
('default', base_mgr),
('food_mgr2', mgr2),
(b'food_mgr1', mgr1),
('food_mgr1', mgr1),
]
))

View file

@ -30,7 +30,7 @@ def get_foo():
class Bar(models.Model):
b = models.CharField(max_length=10)
a = models.ForeignKey(Foo, models.CASCADE, default=get_foo, related_name=b'bars')
a = models.ForeignKey(Foo, models.CASCADE, default=get_foo, related_name='bars')
class Whiz(models.Model):

View file

@ -42,8 +42,8 @@ class SimpleTests(HStoreTestCase):
self.assertEqual(reloaded.field, value)
def test_key_val_cast_to_string(self):
value = {'a': 1, 'b': 'B', 2: 'c', 'ï': 'ê', b'x': b'test'}
expected_value = {'a': '1', 'b': 'B', '2': 'c', 'ï': 'ê', 'x': 'test'}
value = {'a': 1, 'b': 'B', 2: 'c', 'ï': 'ê'}
expected_value = {'a': '1', 'b': 'B', '2': 'c', 'ï': 'ê'}
instance = HStoreModel.objects.create(field=value)
instance = HStoreModel.objects.get()

View file

@ -51,9 +51,6 @@ class StringLookupTests(TestCase):
fx.save()
self.assertEqual(Foo.objects.get(friend__contains='\xe7'), fx)
# We can also do the above query using UTF-8 strings.
self.assertEqual(Foo.objects.get(friend__contains=b'\xc3\xa7'), fx)
def test_queries_on_textfields(self):
"""
Regression tests for #5087

View file

@ -157,11 +157,6 @@ class TestUtilsText(SimpleTestCase):
self.assertEqual(text.normalize_newlines(""), "")
self.assertEqual(text.normalize_newlines(lazystr("abc\ndef\rghi\r\n")), "abc\ndef\nghi\n")
def test_normalize_newlines_bytes(self):
"""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")
def test_phone2numeric(self):
numeric = text.phone2numeric('0800 flowers')
self.assertEqual(numeric, '0800 3569377')