1
0
mirror of https://github.com/django/django.git synced 2025-03-05 15:02:31 +00:00

Made test for memoryview handling in force_bytes() more strict.

This commit is contained in:
Sergey Fedoseev 2018-07-09 20:01:42 +05:00 committed by Tim Graham
parent c9c6c16650
commit bdcde79c5f

View File

@ -58,7 +58,11 @@ class TestEncodingUtils(SimpleTestCase):
self.assertEqual(result, b'This is an exception, voil') self.assertEqual(result, b'This is an exception, voil')
def test_force_bytes_memory_view(self): def test_force_bytes_memory_view(self):
self.assertEqual(force_bytes(memoryview(b'abc')), b'abc') data = b'abc'
result = force_bytes(memoryview(data))
# Type check is needed because memoryview(bytes) == bytes.
self.assertIs(type(result), bytes)
self.assertEqual(result, data)
def test_smart_bytes(self): def test_smart_bytes(self):
class Test: class Test: