diff options
author | INADA Naoki <inada-n@klab.com> | 2014-03-26 03:00:47 +0900 |
---|---|---|
committer | INADA Naoki <inada-n@klab.com> | 2014-03-26 03:00:47 +0900 |
commit | e7f87d9d41532b0956ebcd9f7be52df979842466 (patch) | |
tree | c69c24474e1065415bca4c71f139cdafcd423f9f | |
parent | 6c0c306f966c5cb1caeb2d6b0712ae3d0edd4d82 (diff) | |
download | msgpack-python-e7f87d9d41532b0956ebcd9f7be52df979842466.tar.gz |
More limit check.
-rw-r--r-- | test/test_limits.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/test/test_limits.py b/test/test_limits.py index 970f722..2879c0a 100644 --- a/test/test_limits.py +++ b/test/test_limits.py @@ -2,7 +2,7 @@ # coding: utf-8 import pytest -from msgpack import packb, unpackb +from msgpack import packb, unpackb, Packer def test_integer(): @@ -16,11 +16,27 @@ def test_integer(): with pytest.raises(OverflowError): packb(x+1) + +def test_array_header(): + packer = Packer() + packer.pack_array_header(2**32-1) + with pytest.raises(ValueError): + packer.pack_array_header(2**32) + + +def test_map_header(): + packer = Packer() + packer.pack_map_header(2**32-1) + with pytest.raises(ValueError): + packer.pack_array_header(2**32) + + @pytest.mark.skipif(True, "Requires very large memory.") def test_binary(): x = b'x' * (2**32 - 1) assert unpackb(packb(x)) == x - x += b'y' + del x + x = b'x' * (2**32) with pytest.raises(ValueError): packb(x) |