mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-04-10 05:20:17 +00:00
Add test for .skip()
This commit is contained in:
parent
9963522d46
commit
48d693c1b9
2 changed files with 15 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue