File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 22# coding: utf-8
33import pytest
44
5- from msgpack import packb , unpackb
5+ from msgpack import packb , unpackb , Packer
66
77
88def 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." )
2035def 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
You can’t perform that action at this time.
0 commit comments