diff options
author | Bas Westerbaan <bas@westerbaan.name> | 2013-01-29 02:58:26 +0100 |
---|---|---|
committer | Bas Westerbaan <bas@westerbaan.name> | 2013-01-29 02:58:26 +0100 |
commit | d2f549a47094b2a29cc94bc50029ebdc85508861 (patch) | |
tree | 71df223c08876c1032b3a920b6867004945a7bc1 /test/test_sequnpack.py | |
parent | fb81f80d14613bd2ac3e63029a47bb0512c25dd5 (diff) | |
download | msgpack-python-d2f549a47094b2a29cc94bc50029ebdc85508861.tar.gz |
fallback: add actual rollback and add a testcase for it
Signed-off-by: Bas Westerbaan <bas@westerbaan.name>
Diffstat (limited to 'test/test_sequnpack.py')
-rw-r--r-- | test/test_sequnpack.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/test_sequnpack.py b/test/test_sequnpack.py index fc1f712..1da383c 100644 --- a/test/test_sequnpack.py +++ b/test/test_sequnpack.py @@ -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') |