mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-10-19 20:03:16 +00:00
python: Support old buffer protocol when unpack. (experimental)
This commit is contained in:
parent
3903979a84
commit
a09c85ff9c
3 changed files with 65 additions and 113 deletions
|
@ -7,10 +7,10 @@ from msgpack import packb, unpackb
|
|||
|
||||
def test_unpack_buffer():
|
||||
from array import array
|
||||
buf = array('b')
|
||||
buf.fromstring(packb(['foo', 'bar']))
|
||||
buf = array('c')
|
||||
buf.fromstring(packb(('foo', 'bar')))
|
||||
obj = unpackb(buf)
|
||||
assert_equal(['foo', 'bar'], obj)
|
||||
assert_equal(('foo', 'bar'), obj)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue