diff options
| author | Inada Naoki <songofacandy@gmail.com> | 2022-05-24 19:46:51 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-24 19:46:51 +0900 |
| commit | 500a238028bdebe123b502b07769578b5f0e8a3a (patch) | |
| tree | 9c5796a126485a13c3963a84e30a4542df9b2fe4 /test | |
| parent | b75e3412fb8a2b6d6cd1da1b7063e14f6bfc0337 (diff) | |
| download | msgpack-python-500a238028bdebe123b502b07769578b5f0e8a3a.tar.gz | |
Fix Unpacker max_buffer_length handling (#506)
Diffstat (limited to 'test')
| -rw-r--r-- | test/test_sequnpack.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test/test_sequnpack.py b/test/test_sequnpack.py index 9f20c07..c091076 100644 --- a/test/test_sequnpack.py +++ b/test/test_sequnpack.py @@ -2,7 +2,7 @@ # coding: utf-8 import io from msgpack import Unpacker, BufferFull -from msgpack import pack +from msgpack import pack, packb from msgpack.exceptions import OutOfData from pytest import raises @@ -78,6 +78,15 @@ def test_maxbuffersize(): assert ord("b") == next(unpacker) +def test_maxbuffersize_file(): + buff = io.BytesIO(packb(b"a" * 10) + packb([b"a" * 20] * 2)) + unpacker = Unpacker(buff, read_size=1, max_buffer_size=19, max_bin_len=20) + assert unpacker.unpack() == b"a" * 10 + # assert unpacker.unpack() == [b"a" * 20]*2 + with raises(BufferFull): + print(unpacker.unpack()) + + def test_readbytes(): unpacker = Unpacker(read_size=3) unpacker.feed(b"foobar") |
