summaryrefslogtreecommitdiff
path: root/test3
diff options
context:
space:
mode:
authortailhook <pc@gafol.net>2011-08-22 01:52:45 +0900
committerINADA Naoki <songofacandy@gmail.com>2011-08-22 01:52:45 +0900
commit8c3c8a250b5f6f129e5e077a224ec6916cc87437 (patch)
tree31059bfc338c441bbe09fb23747b39137894a3fb /test3
parent4a1ce19addc6fc5faf26101b16124401113889d1 (diff)
downloadmsgpack-python-8c3c8a250b5f6f129e5e077a224ec6916cc87437.tar.gz
Fixed `encoding` argument for unpacker in Python
Diffstat (limited to 'test3')
-rw-r--r--test3/test_pack.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/test3/test_pack.py b/test3/test_pack.py
index e53f7e6..5ff04e7 100644
--- a/test3/test_pack.py
+++ b/test3/test_pack.py
@@ -4,7 +4,9 @@
from nose import main
from nose.tools import *
-from msgpack import packs, unpacks
+from msgpack import packs, unpacks, Unpacker, Packer
+
+from io import BytesIO
def check(data):
re = unpacks(packs(data))
@@ -31,13 +33,16 @@ def testPackUnicode():
for td in test_data:
re = unpacks(packs(td, encoding='utf-8'), encoding='utf-8')
assert_equal(re, td)
+ packer = Packer(encoding='utf-8')
+ data = packer.pack(td)
+ re = Unpacker(BytesIO(data), encoding='utf-8').unpack()
+ assert_equal(re, td)
def testPackUTF32():
test_data = [
"", "abcd", ("defgh",), "Русский текст",
]
for td in test_data:
- print(packs(td, encoding='utf-32'))
re = unpacks(packs(td, encoding='utf-32'), encoding='utf-32')
assert_equal(re, td)