11#!/usr/bin/env python
22# coding: utf-8
33
4+ import six
45from nose import main
56from nose .tools import *
67from nose .plugins .skip import SkipTest
@@ -29,7 +30,7 @@ def testPack():
2930
3031def testPackUnicode ():
3132 test_data = [
32- "" , "abcd" , ("defgh" ,), "Русский текст" ,
33+ six . u ( "" ), six . u ( "abcd" ) , (six . u ( "defgh" ) ,), six . u ( "Русский текст" ) ,
3334 ]
3435 for td in test_data :
3536 re = unpacks (packs (td , encoding = 'utf-8' ), encoding = 'utf-8' )
@@ -42,7 +43,10 @@ def testPackUnicode():
4243def testPackUTF32 ():
4344 try :
4445 test_data = [
45- "" , "abcd" , ("defgh" ,), "Русский текст" ,
46+ six .u ("" ),
47+ six .u ("abcd" ),
48+ (six .u ("defgh" ),),
49+ six .u ("Русский текст" ),
4650 ]
4751 for td in test_data :
4852 re = unpacks (packs (td , encoding = 'utf-32' ), encoding = 'utf-32' )
@@ -68,15 +72,15 @@ def testStrictUnicodeUnpack():
6872
6973@raises (UnicodeEncodeError )
7074def testStrictUnicodePack ():
71- packs ("abc\xed def" , encoding = 'ascii' , unicode_errors = 'strict' )
75+ packs (six . u ( "abc\xed def" ) , encoding = 'ascii' , unicode_errors = 'strict' )
7276
7377def testIgnoreErrorsPack ():
74- re = unpacks (packs ("abcФФФdef" , encoding = 'ascii' , unicode_errors = 'ignore' ), encoding = 'utf-8' )
75- assert_equal (re , "abcdef" )
78+ re = unpacks (packs (six . u ( "abcФФФdef" ) , encoding = 'ascii' , unicode_errors = 'ignore' ), encoding = 'utf-8' )
79+ assert_equal (re , six . u ( "abcdef" ) )
7680
7781@raises (TypeError )
7882def testNoEncoding ():
79- packs ("abc" , encoding = None )
83+ packs (six . u ( "abc" ) , encoding = None )
8084
8185def testDecodeBinary ():
8286 re = unpacks (packs ("abc" ), encoding = None )
0 commit comments