mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-10-19 20:03:16 +00:00
enable unpacking from memoryview
This commit is contained in:
parent
b887c1a4ad
commit
2b63e9fbbb
3 changed files with 106 additions and 32 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue