Split exceptions.

This commit is contained in:
INADA Naoki 2012-12-10 00:31:19 +09:00
parent dd5c76b955
commit 219d47503c
4 changed files with 45 additions and 13 deletions

View file

@ -1,5 +1,5 @@
"""Test Unpacker's read_array_header and read_map_header methods"""
from msgpack import packb, Unpacker
from msgpack import packb, Unpacker, OutOfData
UnexpectedTypeException = ValueError
def test_read_array_header():
@ -12,7 +12,7 @@ def test_read_array_header():
try:
unpacker.unpack()
assert 0, 'should raise exception'
except StopIteration:
except OutOfData:
assert 1, 'okay'
@ -25,7 +25,7 @@ def test_read_map_header():
try:
unpacker.unpack()
assert 0, 'should raise exception'
except StopIteration:
except OutOfData:
assert 1, 'okay'
def test_incorrect_type_array():

View file

@ -3,6 +3,7 @@
import six
from msgpack import Unpacker, BufferFull
from msgpack.exceptions import OutOfData
import nose
def test_foobar():
@ -17,7 +18,7 @@ def test_foobar():
try:
o = unpacker.unpack()
assert 0, "should raise exception"
except StopIteration:
except OutOfData:
assert 1, "ok"
unpacker.feed(b'foo')
@ -41,7 +42,7 @@ def test_foobar_skip():
try:
o = unpacker.unpack()
assert 0, "should raise exception"
except StopIteration:
except OutOfData:
assert 1, "ok"
def test_maxbuffersize():