summaryrefslogtreecommitdiff
path: root/test/test_pack.py
diff options
context:
space:
mode:
authorINADA Naoki <songofacandy@gmail.com>2012-06-19 14:20:56 +0900
committerINADA Naoki <songofacandy@gmail.com>2012-06-19 14:20:56 +0900
commit636f4529aa8426f4ee3e25e0b4931bb37384df1e (patch)
tree4ed83eea4ae197c61cd3793305fc7856fbb8e6f8 /test/test_pack.py
parent0b38e86534130f625cbea2f9446e8e52ef5f5a06 (diff)
downloadmsgpack-python-636f4529aa8426f4ee3e25e0b4931bb37384df1e.tar.gz
Fix tests to pass.
Diffstat (limited to 'test/test_pack.py')
-rw-r--r--test/test_pack.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/test/test_pack.py b/test/test_pack.py
index 480af28..88b6dac 100644
--- a/test/test_pack.py
+++ b/test/test_pack.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# coding: utf-8
+import six
from nose import main
from nose.tools import *
from nose.plugins.skip import SkipTest
@@ -29,7 +30,7 @@ def testPack():
def testPackUnicode():
test_data = [
- "", "abcd", ("defgh",), "Русский текст",
+ six.u(""), six.u("abcd"), (six.u("defgh"),), six.u("Русский текст"),
]
for td in test_data:
re = unpacks(packs(td, encoding='utf-8'), encoding='utf-8')
@@ -42,7 +43,10 @@ def testPackUnicode():
def testPackUTF32():
try:
test_data = [
- "", "abcd", ("defgh",), "Русский текст",
+ six.u(""),
+ six.u("abcd"),
+ (six.u("defgh"),),
+ six.u("Русский текст"),
]
for td in test_data:
re = unpacks(packs(td, encoding='utf-32'), encoding='utf-32')
@@ -68,15 +72,15 @@ def testStrictUnicodeUnpack():
@raises(UnicodeEncodeError)
def testStrictUnicodePack():
- packs("abc\xeddef", encoding='ascii', unicode_errors='strict')
+ packs(six.u("abc\xeddef"), encoding='ascii', unicode_errors='strict')
def testIgnoreErrorsPack():
- re = unpacks(packs("abcФФФdef", encoding='ascii', unicode_errors='ignore'), encoding='utf-8')
- assert_equal(re, "abcdef")
+ re = unpacks(packs(six.u("abcФФФdef"), encoding='ascii', unicode_errors='ignore'), encoding='utf-8')
+ assert_equal(re, six.u("abcdef"))
@raises(TypeError)
def testNoEncoding():
- packs("abc", encoding=None)
+ packs(six.u("abc"), encoding=None)
def testDecodeBinary():
re = unpacks(packs("abc"), encoding=None)