mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-11-02 02:20:54 +00:00
Add strict_map_key option to unpacker
This commit is contained in:
parent
3c9c6edbc8
commit
e9086a34e4
3 changed files with 28 additions and 5 deletions
|
|
@ -50,3 +50,14 @@ def test_invalidvalue():
|
|||
|
||||
with raises(StackError):
|
||||
unpackb(b"\x91" * 3000) # nested fixarray(len=1)
|
||||
|
||||
|
||||
def test_strict_map_key():
|
||||
valid = {u"unicode": 1, b"bytes": 2}
|
||||
packed = packb(valid, use_bin_type=True)
|
||||
assert valid == unpackb(packed, raw=True)
|
||||
|
||||
invalid = {42: 1}
|
||||
packed = packb(invalid, use_bin_type=True)
|
||||
with raises(ValueError):
|
||||
unpackb(packed, raw=True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue