mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-11-01 01:50:54 +00:00
fallback: add actual rollback and add a testcase for it
Signed-off-by: Bas Westerbaan <bas@westerbaan.name>
This commit is contained in:
parent
fb81f80d14
commit
d2f549a470
2 changed files with 28 additions and 8 deletions
|
|
@ -7,6 +7,21 @@ from msgpack.exceptions import OutOfData
|
|||
from pytest import raises
|
||||
|
||||
|
||||
def test_partialdata():
|
||||
unpacker = Unpacker()
|
||||
unpacker.feed(b'\xa5')
|
||||
with raises(StopIteration): next(iter(unpacker))
|
||||
unpacker.feed(b'h')
|
||||
with raises(StopIteration): next(iter(unpacker))
|
||||
unpacker.feed(b'a')
|
||||
with raises(StopIteration): next(iter(unpacker))
|
||||
unpacker.feed(b'l')
|
||||
with raises(StopIteration): next(iter(unpacker))
|
||||
unpacker.feed(b'l')
|
||||
with raises(StopIteration): next(iter(unpacker))
|
||||
unpacker.feed(b'o')
|
||||
assert next(iter(unpacker)) == 'hallo'
|
||||
|
||||
def test_foobar():
|
||||
unpacker = Unpacker(read_size=3, use_list=1)
|
||||
unpacker.feed(b'foobar')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue