summaryrefslogtreecommitdiff
path: root/test/test_sequnpack.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_sequnpack.py')
-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 21fc3be..dac36a8 100644
--- a/test/test_sequnpack.py
+++ b/test/test_sequnpack.py
@@ -28,6 +28,21 @@ def test_foobar():
k += 1
assert k == len(b'foobar')
+def test_foobar_skip():
+ unpacker = Unpacker(read_size=3, use_list=1)
+ 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)
unpacker = Unpacker(read_size=3, max_buffer_size=3, use_list=1)