mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-10-20 12:23:16 +00:00
Rename
This commit is contained in:
parent
7b24d0fe5a
commit
38cf835c95
1 changed files with 19 additions and 0 deletions
19
test/test_unpack.py
Normal file
19
test/test_unpack.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
from io import BytesIO
|
||||||
|
from msgpack import Unpacker, packb, OutOfData
|
||||||
|
from pytest import raises
|
||||||
|
|
||||||
|
|
||||||
|
def test_unpack_array_header_from_file():
|
||||||
|
f = BytesIO(packb([1,2,3,4]))
|
||||||
|
unpacker = Unpacker(f)
|
||||||
|
assert unpacker.read_array_header() == 4
|
||||||
|
assert unpacker.unpack() == 1
|
||||||
|
assert unpacker.unpack() == 2
|
||||||
|
assert unpacker.unpack() == 3
|
||||||
|
assert unpacker.unpack() == 4
|
||||||
|
with raises(OutOfData):
|
||||||
|
unpacker.unpack()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
test_unpack_array_header_from_file()
|
Loading…
Add table
Add a link
Reference in a new issue