8000 More limit check. · nresare/msgpack-python@e7f87d9 · GitHub
[go: up one dir, main page]

Skip to content

Commit e7f87d9

Browse files
committed
More limit check.
1 parent 6c0c306 commit e7f87d9

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

test/test_limits.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# coding: utf-8
33
import pytest
44

5-
from msgpack import packb, unpackb
5+
from msgpack import packb, unpackb, Packer
66

77

88
def test_integer():
@@ -16,11 +16,27 @@ def test_integer():
1616
with pytest.raises(OverflowError):
1717
packb(x+1)
1818

19+
20+
def test_array_header():
21+
packer = Packer()
22+
packer.pack_array_header(2**32-1)
23+
with pytest.raises(ValueError):
24+
packer.pack_array_header(2**32)
25+
26+
27+
def test_map_header():
28+
packer = Packer()
29+
packer.pack_map_header(2**32-1)
30+
with pytest.raises(ValueError):
31+
packer.pack_array_header(2**32)
32+
33+
1934
@pytest.mark.skipif(True, "Requires very large memory.")
2035
def test_binary():
2136
x = b'x' * (2**32 - 1)
2237
assert unpackb(packb(x)) == x
23-
x += b'y'
38+
del x
39+
x = b'x' * (2**32)
2440
with pytest.raises(ValueError):
2541
packb(x)
2642

0 commit comments

Comments
 (0)
0