mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-06-28 03:30:24 +00:00
Add missing autoreset in Packer.pack_ext_type (#663)
This commit is contained in:
parent
4a07745675
commit
284782d647
4 changed files with 25 additions and 1 deletions
|
|
@ -6,7 +6,7 @@ from msgpack import ExtType
|
|||
|
||||
def test_pack_ext_type():
|
||||
def p(s):
|
||||
packer = msgpack.Packer()
|
||||
packer = msgpack.Packer(autoreset=False)
|
||||
packer.pack_ext_type(0x42, s)
|
||||
return packer.bytes()
|
||||
|
||||
|
|
@ -20,6 +20,15 @@ def test_pack_ext_type():
|
|||
assert p(b"A" * 0x00012345) == b"\xc9\x00\x01\x23\x45\x42" + b"A" * 0x00012345 # ext 32
|
||||
|
||||
|
||||
def test_pack_ext_type_autoreset():
|
||||
packer = msgpack.Packer()
|
||||
|
||||
assert packer.pack_ext_type(0x42, b"A") == b"\xd4\x42A"
|
||||
assert packer.bytes() == b""
|
||||
assert packer.pack_ext_type(0x42, b"ABC") == b"\xc7\x03\x42ABC"
|
||||
assert packer.bytes() == b""
|
||||
|
||||
|
||||
def test_unpack_ext_type():
|
||||
def check(b, expected):
|
||||
assert msgpack.unpackb(b) == expected
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue