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
1 changed files with 5 additions and 1 deletions

View File

@ -58,7 +58,11 @@ class TestEncodingUtils(SimpleTestCase):
self.assertEqual(result, b'This is an exception, voil')
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):
class Test: