Allow ValueError for packing integer overs format limit.

This commit is contained in:
INADA Naoki 2014-03-26 12:50:28 +09:00
parent ef5d93d4ea
commit 7d0e145e91

View file

@ -8,12 +8,12 @@ from msgpack import packb, unpackb, Packer
def test_integer(): def test_integer():
x = -(2 ** 63) x = -(2 ** 63)
assert unpackb(packb(x)) == x assert unpackb(packb(x)) == x
with pytest.raises(OverflowError): with pytest.raises((OverflowError, ValueError)):
packb(x-1) packb(x-1)
x = 2 ** 64 - 1 x = 2 ** 64 - 1
assert unpackb(packb(x)) == x assert unpackb(packb(x)) == x
with pytest.raises(OverflowError): with pytest.raises((OverflowError, ValueError)):
packb(x+1) packb(x+1)