mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-10-19 20:03:16 +00:00
Auto limit configuration (#342)
This commit is contained in:
parent
f46523b1af
commit
28b5f46a34
3 changed files with 92 additions and 28 deletions
|
@ -105,7 +105,6 @@ def test_max_ext_len():
|
|||
unpacker.unpack()
|
||||
|
||||
|
||||
|
||||
# PyPy fails following tests because of constant folding?
|
||||
# https://bugs.pypy.org/issue1721
|
||||
#@pytest.mark.skipif(True, reason="Requires very large memory.")
|
||||
|
@ -134,3 +133,27 @@ def test_max_ext_len():
|
|||
# x.append(0)
|
||||
# with pytest.raises(ValueError):
|
||||
# packb(x)
|
||||
|
||||
|
||||
# auto max len
|
||||
|
||||
def test_auto_max_array_len():
|
||||
packed = b'\xde\x00\x06zz'
|
||||
with pytest.raises(UnpackValueError):
|
||||
unpackb(packed, raw=False)
|
||||
|
||||
unpacker = Unpacker(max_buffer_size=5, raw=False)
|
||||
unpacker.feed(packed)
|
||||
with pytest.raises(UnpackValueError):
|
||||
unpacker.unpack()
|
||||
|
||||
def test_auto_max_map_len():
|
||||
# len(packed) == 6 -> max_map_len == 3
|
||||
packed = b'\xde\x00\x04zzz'
|
||||
with pytest.raises(UnpackValueError):
|
||||
unpackb(packed, raw=False)
|
||||
|
||||
unpacker = Unpacker(max_buffer_size=6, raw=False)
|
||||
unpacker.feed(packed)
|
||||
with pytest.raises(UnpackValueError):
|
||||
unpacker.unpack()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue