diff options
author | INADA Naoki <inada-n@klab.com> | 2013-10-20 15:08:31 +0900 |
---|---|---|
committer | INADA Naoki <inada-n@klab.com> | 2013-10-20 15:08:31 +0900 |
commit | 27f0cba8a5f36393517ee85d2c339847b76e0c6b (patch) | |
tree | 470bc84905240c82d2e1f4e710d55a288661f635 /test/test_sequnpack.py | |
parent | 7123341ca89a9a3afee8521cc16a1a419ea8871e (diff) | |
parent | 6386481024ec045d9ef991a2c975902276812508 (diff) | |
download | msgpack-python-27f0cba8a5f36393517ee85d2c339847b76e0c6b.tar.gz |
Merge branch 'master' of https://github.com/antocuni/msgpack-python into newspec
Conflicts:
msgpack/fallback.py
msgpack/unpack.h
msgpack/unpack_define.h
msgpack/unpack_template.h
Diffstat (limited to 'test/test_sequnpack.py')
-rw-r--r-- | test/test_sequnpack.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/test/test_sequnpack.py b/test/test_sequnpack.py index 9db14ca..abc447a 100644 --- a/test/test_sequnpack.py +++ b/test/test_sequnpack.py @@ -1,9 +1,10 @@ #!/usr/bin/env python # coding: utf-8 +import py import six from msgpack import Unpacker, BufferFull -from msgpack.exceptions import OutOfData +from msgpack.exceptions import OutOfData, ExtraData, UnpackValueError from pytest import raises @@ -85,3 +86,15 @@ def test_readbytes(): assert unpacker.unpack() == ord(b'a') assert unpacker.unpack() == ord(b'r') +def test_unpack_one(): + unpacker = Unpacker() + unpacker.feed('\xda\x00\x03abc') + assert unpacker.unpack_one() == 'abc' + # + unpacker = Unpacker() + unpacker.feed('\xda\x00\x03abcd') + py.test.raises(ExtraData, "unpacker.unpack_one()") + # + unpacker = Unpacker() + unpacker.feed('\xda\x00\x03ab') + py.test.raises(UnpackValueError, "unpacker.unpack_one()") |