enable unpacking from memoryview

This commit is contained in:
folz 2016-05-07 15:18:20 +02:00
parent b887c1a4ad
commit 2b63e9fbbb
3 changed files with 106 additions and 32 deletions

View file

@ -18,3 +18,12 @@ def test_unpack_bytearray():
assert [b'foo', b'bar'] == obj
expected_type = bytes
assert all(type(s) == expected_type for s in obj)
def test_unpack_memoryview():
buf = bytearray(packb(('foo', 'bar')))
view = memoryview(buf)
obj = unpackb(view, use_list=1)
assert [b'foo', b'bar'] == obj
expected_type = bytes
assert all(type(s) == expected_type for s in obj)