mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-10-20 04:13:16 +00:00
blacken test
This commit is contained in:
parent
e557e17cbd
commit
10e5e39ff9
16 changed files with 501 additions and 334 deletions
|
@ -6,27 +6,28 @@ from msgpack import packb, unpackb
|
|||
|
||||
def test_unpack_buffer():
|
||||
from array import array
|
||||
buf = array('b')
|
||||
|
||||
buf = array("b")
|
||||
try:
|
||||
buf.frombytes(packb((b'foo', b'bar')))
|
||||
buf.frombytes(packb((b"foo", b"bar")))
|
||||
except AttributeError: # PY2
|
||||
buf.fromstring(packb((b'foo', b'bar')))
|
||||
buf.fromstring(packb((b"foo", b"bar")))
|
||||
obj = unpackb(buf, use_list=1)
|
||||
assert [b'foo', b'bar'] == obj
|
||||
assert [b"foo", b"bar"] == obj
|
||||
|
||||
|
||||
def test_unpack_bytearray():
|
||||
buf = bytearray(packb(('foo', 'bar')))
|
||||
buf = bytearray(packb(("foo", "bar")))
|
||||
obj = unpackb(buf, use_list=1)
|
||||
assert [b'foo', b'bar'] == obj
|
||||
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')))
|
||||
buf = bytearray(packb(("foo", "bar")))
|
||||
view = memoryview(buf)
|
||||
obj = unpackb(view, use_list=1)
|
||||
assert [b'foo', b'bar'] == obj
|
||||
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