summaryrefslogtreecommitdiff
path: root/test/test_sequnpack.py
diff options
context:
space:
mode:
authorINADA Naoki <inada-n@klab.com>2012-09-23 10:09:51 +0900
committerINADA Naoki <inada-n@klab.com>2012-09-23 10:09:51 +0900
commit48d693c1b9613fd976a3bf668f692ec22ad4a520 (patch)
tree630a779694c099b5a456ee5b9bdc4b0ef2744445 /test/test_sequnpack.py
parent9963522d46cefe97594204e1a0229571c7e91b89 (diff)
downloadmsgpack-python-48d693c1b9613fd976a3bf668f692ec22ad4a520.tar.gz
Add test for `.skip()`
Diffstat (limited to 'test/test_sequnpack.py')
-rw-r--r--test/test_sequnpack.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/test_sequnpack.py b/test/test_sequnpack.py
index b1b80b2..aa47d3c 100644
--- a/test/test_sequnpack.py
+++ b/test/test_sequnpack.py
@@ -28,6 +28,20 @@ def test_foobar():
k += 1
assert k == len(b'foobar')
+def test_foobar_skip():
+ unpacker = Unpacker(read_size=3)
+ unpacker.feed(b'foobar')
+ assert unpacker.unpack() == ord(b'f')
+ unpacker.skip()
+ assert unpacker.unpack() == ord(b'o')
+ unpacker.skip()
+ assert unpacker.unpack() == ord(b'a')
+ unpacker.skip()
+ try:
+ o = unpacker.unpack()
+ assert 0, "should raise exception"
+ except StopIteration:
+ assert 1, "ok"
def test_maxbuffersize():
nose.tools.assert_raises(ValueError, Unpacker, read_size=5, max_buffer_size=3)