Support object_pairs_hook

Merge remote-tracking branch 'jnothman/object_pairs_hook' into 0.2-maint
Conflicts:
	msgpack/_msgpack.pyx
	test/test_pack.py
	test/test_sequnpack.py
This commit is contained in:
INADA Naoki 2012-09-24 03:05:39 +09:00
commit e381032641
7 changed files with 143 additions and 90 deletions

View file

@ -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)