diff --git a/django/http/multipartparser.py b/django/http/multipartparser.py index 543fc4a552..7b45404d9d 100644 --- a/django/http/multipartparser.py +++ b/django/http/multipartparser.py @@ -69,7 +69,7 @@ class MultiPartParser: ctypes, opts = parse_header(content_type.encode('ascii')) boundary = opts.get('boundary') if not boundary or not cgi.valid_boundary(boundary): - raise MultiPartParserError('Invalid boundary in multipart: %s' % boundary) + raise MultiPartParserError('Invalid boundary in multipart: %s' % boundary.decode()) # Content-Length should contain the length of the body we are about # to receive. diff --git a/tests/forms_tests/field_tests/test_choicefield.py b/tests/forms_tests/field_tests/test_choicefield.py index f500c18680..fd382e47ca 100644 --- a/tests/forms_tests/field_tests/test_choicefield.py +++ b/tests/forms_tests/field_tests/test_choicefield.py @@ -1,5 +1,5 @@ from django.forms import ChoiceField, Form, ValidationError -from django.test import SimpleTestCase, ignore_warnings +from django.test import SimpleTestCase from . import FormFieldAssertionsMixin @@ -82,16 +82,3 @@ class ChoiceFieldTest(FormFieldAssertionsMixin, SimpleTestCase): '' ) - - @ignore_warnings(category=UnicodeWarning) - def test_utf8_bytesrings(self): - # Choice validation with UTF-8 bytestrings as input (these are the - # Russian abbreviations "мес." and "шт.". - f = ChoiceField( - choices=( - (b'\xd0\xbc\xd0\xb5\xd1\x81.', b'\xd0\xbc\xd0\xb5\xd1\x81.'), - (b'\xd1\x88\xd1\x82.', b'\xd1\x88\xd1\x82.'), - ), - ) - self.assertEqual(f.clean('\u0448\u0442.'), '\u0448\u0442.') - self.assertEqual(f.clean(b'\xd1\x88\xd1\x82.'), '\u0448\u0442.') diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py index 8d8d5a57a4..9b0feab8ea 100644 --- a/tests/view_tests/tests/test_debug.py +++ b/tests/view_tests/tests/test_debug.py @@ -140,7 +140,7 @@ class DebugViewTests(LoggingCaptureMixin, SimpleTestCase): id_repr = match.group('id') self.assertFalse( re.search(b'[^c0-9]', id_repr), - "Numeric IDs in debug response HTML page shouldn't be localized (value: %s)." % id_repr + "Numeric IDs in debug response HTML page shouldn't be localized (value: %s)." % id_repr.decode() ) def test_template_exceptions(self): diff --git a/tests/view_tests/tests/test_defaults.py b/tests/view_tests/tests/test_defaults.py index 3ab109a57c..b36d5b5b58 100644 --- a/tests/view_tests/tests/test_defaults.py +++ b/tests/view_tests/tests/test_defaults.py @@ -64,8 +64,8 @@ class DefaultsTests(TestCase): # See ticket #14565 for url in self.nonexistent_urls: response = self.client.get(url) - self.assertNotEqual(response.content, 'NOTPROVIDED') - self.assertNotEqual(response.content, '') + self.assertNotEqual(response.content, b'NOTPROVIDED') + self.assertNotEqual(response.content, b'') def test_server_error(self): "The server_error view raises a 500 status"