mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-11-06 20:40:59 +00:00
Allow ValueError for packing integer overs format limit.
This commit is contained in:
parent
ef5d93d4ea
commit
7d0e145e91
1 changed files with 2 additions and 2 deletions
|
|
@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue