diff options
author | INADA Naoki <songofacandy@gmail.com> | 2010-11-03 03:11:00 +0900 |
---|---|---|
committer | INADA Naoki <songofacandy@gmail.com> | 2010-11-03 03:11:00 +0900 |
commit | a09c85ff9c846384cf681fa955ce931010995055 (patch) | |
tree | eb84339700ef0d5892adc12d9a47dc4531c0e708 /test | |
parent | 3903979a84c4d450acc55faceb3f816ff7a32398 (diff) | |
download | msgpack-python-a09c85ff9c846384cf681fa955ce931010995055.tar.gz |
python: Support old buffer protocol when unpack. (experimental)
Diffstat (limited to 'test')
-rw-r--r-- | test/test_buffer.py | 6 | ||||
-rw-r--r-- | test/test_sequnpack.py | 16 |
2 files changed, 11 insertions, 11 deletions
diff --git a/test/test_buffer.py b/test/test_buffer.py index 436b554..ce7a72d 100644 --- a/test/test_buffer.py +++ b/test/test_buffer.py @@ -7,10 +7,10 @@ from msgpack import packb, unpackb def test_unpack_buffer(): from array import array - buf = array('b') - buf.fromstring(packb(['foo', 'bar'])) + buf = array('c') + buf.fromstring(packb(('foo', 'bar'))) obj = unpackb(buf) - assert_equal(['foo', 'bar'], obj) + assert_equal(('foo', 'bar'), obj) if __name__ == '__main__': main() diff --git a/test/test_sequnpack.py b/test/test_sequnpack.py index 789ccd2..df6e308 100644 --- a/test/test_sequnpack.py +++ b/test/test_sequnpack.py @@ -1,22 +1,22 @@ #!/usr/bin/env python # coding: utf-8 -from __future__ import unicode_literals, print_function +from __future__ import unicode_literals from msgpack import Unpacker def test_foobar(): unpacker = Unpacker(read_size=3) unpacker.feed(b'foobar') - assert unpacker.unpack() == ord('f') - assert unpacker.unpack() == ord('o') - assert unpacker.unpack() == ord('o') - assert unpacker.unpack() == ord('b') - assert unpacker.unpack() == ord('a') - assert unpacker.unpack() == ord('r') + assert unpacker.unpack() == ord(b'f') + assert unpacker.unpack() == ord(b'o') + assert unpacker.unpack() == ord(b'o') + assert unpacker.unpack() == ord(b'b') + assert unpacker.unpack() == ord(b'a') + assert unpacker.unpack() == ord(b'r') try: o = unpacker.unpack() - print("Oops!", o) + print "Oops!", o assert 0 except StopIteration: assert 1 |