mirror of
https://github.com/django/django.git
synced 2025-10-25 06:36:07 +00:00
Made test for memoryview handling in force_bytes() more strict.
This commit is contained in:
committed by
Tim Graham
parent
c9c6c16650
commit
bdcde79c5f
@@ -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:
|
||||||
|
|||||||
Reference in New Issue
Block a user