@@ -31,14 +31,14 @@ def testPack():
31
31
32
32
def testPackUnicode ():
33
33
test_data = [
34
- six .u ("" ), six .u ("abcd" ), ( six .u ("defgh" ),) , six .u ("Русский текст" ),
34
+ six .u ("" ), six .u ("abcd" ), [ six .u ("defgh" )] , six .u ("Русский текст" ),
35
35
]
36
36
for td in test_data :
37
- re = unpackb (packb (td , encoding = 'utf-8' ), use_list = 0 , encoding = 'utf-8' )
37
+ re = unpackb (packb (td , encoding = 'utf-8' ), use_list = 1 , encoding = 'utf-8' )
38
38
assert_equal (re , td )
39
39
packer = Packer (encoding = 'utf-8' )
40
40
data = packer .pack (td )
41
- re = Unpacker (BytesIO (data ), encoding = 'utf-8' ).unpack ()
41
+ re = Unpacker (BytesIO (data ), encoding = 'utf-8' , use_list = 1 ).unpack ()
42
42
assert_equal (re , td )
43
43
44
44
def testPackUTF32 ():
@@ -63,28 +63,27 @@ def testPackBytes():
63
63
check (td )
64
64
65
65
def testIgnoreUnicodeErrors ():
66
- re = unpackb (packb (b'abc\xed def' ),
67
- encoding = 'utf-8' , unicode_errors = 'ignore' )
66
+ re = unpackb (packb (b'abc\xed def' ), encoding = 'utf-8' , unicode_errors = 'ignore' , use_list = 1 )
68
67
assert_equal (re , "abcdef" )
69
68
70
69
@raises (UnicodeDecodeError )
71
70
def testStrictUnicodeUnpack ():
72
- unpackb (packb (b'abc\xed def' ), encoding = 'utf-8' )
71
+ unpackb (packb (b'abc\xed def' ), encoding = 'utf-8' , use_list = 1 )
73
72
74
73
@raises (UnicodeEncodeError )
75
74
def testStrictUnicodePack ():
76
75
packb (six .u ("abc\xed def" ), encoding = 'ascii' , unicode_errors = 'strict' )
77
76
78
77
def testIgnoreErrorsPack ():
79
- re = unpackb (packb (six .u ("abcФФФdef" ), encoding = 'ascii' , unicode_errors = 'ignore' ), encoding = 'utf-8' )
78
+ re = unpackb (packb (six .u ("abcФФФdef" ), encoding = 'ascii' , unicode_errors = 'ignore' ), encoding = 'utf-8' , use_list = 1 )
80
79
assert_equal (re , six .u ("abcdef" ))
81
80
82
81
@raises (TypeError )
83
82
def testNoEncoding ():
84
83
packb (six .u ("abc" ), encoding = None )
85
84
86
85
def testDecodeBinary ():
87
- re = unpackb (packb ("abc" ), encoding = None )
86
+ re = unpackb (packb ("abc" ), encoding = None , use_list = 1 )
88
87
assert_equal (re , b"abc" )
89
88
90
89
def testPackFloat ():
0 commit comments