66from nose .tools import *
77from nose .plugins .skip import SkipTest
88
9- from msgpack import packs , unpacks , Unpacker , Packer
9+ from msgpack import packb , unpackb , Unpacker , Packer
1010
1111from io import BytesIO
1212
1313def check (data ):
14- re = unpacks ( packs (data ))
14+ re = unpackb ( packb (data ))
1515 assert_equal (re , data )
1616
1717def testPack ():
@@ -33,7 +33,7 @@ def testPackUnicode():
3333 six .u ("" ), six .u ("abcd" ), (six .u ("defgh" ),), six .u ("Русский текст" ),
3434 ]
3535 for td in test_data :
36- re = unpacks ( packs (td , encoding = 'utf-8' ), encoding = 'utf-8' )
36+ re = unpackb ( packb (td , encoding = 'utf-8' ), encoding = 'utf-8' )
3737 assert_equal (re , td )
3838 packer = Packer (encoding = 'utf-8' )
3939 data = packer .pack (td )
@@ -49,7 +49,7 @@ def testPackUTF32():
4949 six .u ("Русский текст" ),
5050 ]
5151 for td in test_data :
52- re = unpacks ( packs (td , encoding = 'utf-32' ), encoding = 'utf-32' )
52+ re = unpackb ( packb (td , encoding = 'utf-32' ), encoding = 'utf-32' )
5353 assert_equal (re , td )
5454 except LookupError :
5555 raise SkipTest
@@ -62,28 +62,28 @@ def testPackBytes():
6262 check (td )
6363
6464def testIgnoreUnicodeErrors ():
65- re = unpacks ( packs (b'abc\xed def' ),
65+ re = unpackb ( packb (b'abc\xed def' ),
6666 encoding = 'utf-8' , unicode_errors = 'ignore' )
6767 assert_equal (re , "abcdef" )
6868
6969@raises (UnicodeDecodeError )
7070def testStrictUnicodeUnpack ():
71- unpacks ( packs (b'abc\xed def' ), encoding = 'utf-8' )
71+ unpackb ( packb (b'abc\xed def' ), encoding = 'utf-8' )
7272
7373@raises (UnicodeEncodeError )
7474def testStrictUnicodePack ():
75- packs (six .u ("abc\xed def" ), encoding = 'ascii' , unicode_errors = 'strict' )
75+ packb (six .u ("abc\xed def" ), encoding = 'ascii' , unicode_errors = 'strict' )
7676
7777def testIgnoreErrorsPack ():
78- re = unpacks ( packs (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' )
7979 assert_equal (re , six .u ("abcdef" ))
8080
8181@raises (TypeError )
8282def testNoEncoding ():
83- packs (six .u ("abc" ), encoding = None )
83+ packb (six .u ("abc" ), encoding = None )
8484
8585def testDecodeBinary ():
86- re = unpacks ( packs ("abc" ), encoding = None )
86+ re = unpackb ( packb ("abc" ), encoding = None )
8787 assert_equal (re , b"abc" )
8888
8989if __name__ == '__main__' :
0 commit comments