summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorINADA Naoki <inada-n@klab.com>2013-01-29 15:12:04 +0900
committerINADA Naoki <inada-n@klab.com>2013-01-29 15:12:04 +0900
commit86983e27bc809bd2f25a0ad61ffacb978b1c1ad9 (patch)
tree24c0a910ad8f4bf328a95a532e14591bdd672636 /test
parent5f55e4c6dbc3ec723bea5b9fead2e36224e70b81 (diff)
parent8d6a387dff10dd2150aa86cd96e2bece26546268 (diff)
downloadmsgpack-python-86983e27bc809bd2f25a0ad61ffacb978b1c1ad9.tar.gz
Add purepython fallback. (Merge branch 'purepython')
Diffstat (limited to 'test')
-rw-r--r--test/test_sequnpack.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/test_sequnpack.py b/test/test_sequnpack.py
index fc1f712..9db14ca 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)) == b'hallo'
+
def test_foobar():
unpacker = Unpacker(read_size=3, use_list=1)
unpacker.feed(b'foobar')