Fix tests that occurs unicode error in python 2.x
This commit is contained in:
parent
1303d0cfdd
commit
b128722a0d
@ -21,12 +21,13 @@ def test_translate_list(translator):
|
||||
|
||||
|
||||
def test_detect_language(translator):
|
||||
ko = translator.detect('한국어')
|
||||
ko = translator.detect(u'한국어')
|
||||
en = translator.detect('English')
|
||||
|
||||
assert ko.lang == 'ko'
|
||||
assert en.lang == 'en'
|
||||
|
||||
|
||||
def test_detect_list(translator):
|
||||
items = [u'한국어', ' English']
|
||||
|
||||
|
@ -25,7 +25,12 @@ def test_acquire_token_ascii_less_than_2048(acquirer):
|
||||
|
||||
|
||||
def test_acquire_token_ascii_matches_special_condition(acquirer):
|
||||
text = chr(55296) + chr(56320)
|
||||
def unichar(i):
|
||||
try:
|
||||
return unichr(i)
|
||||
except NameError:
|
||||
return chr(i)
|
||||
text = unichar(55296) + unichar(56320)
|
||||
|
||||
result = acquirer.do(text)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user