summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--msgpack/_msgpack.pyx2
-rw-r--r--test/test_sequnpack.py14
2 files changed, 15 insertions, 1 deletions
diff --git a/msgpack/_msgpack.pyx b/msgpack/_msgpack.pyx
index c8ee7bb..8d37aaa 100644
--- a/msgpack/_msgpack.pyx
+++ b/msgpack/_msgpack.pyx
@@ -451,7 +451,7 @@ cdef class Unpacker(object):
else:
self.file_like = None
- cdef _unpack(self, bint construct):
+ cdef object _unpack(self, bint construct):
cdef int ret
cdef object obj
while 1:
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)