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):
|
def test_detect_language(translator):
|
||||||
ko = translator.detect('한국어')
|
ko = translator.detect(u'한국어')
|
||||||
en = translator.detect('English')
|
en = translator.detect('English')
|
||||||
|
|
||||||
assert ko.lang == 'ko'
|
assert ko.lang == 'ko'
|
||||||
assert en.lang == 'en'
|
assert en.lang == 'en'
|
||||||
|
|
||||||
|
|
||||||
def test_detect_list(translator):
|
def test_detect_list(translator):
|
||||||
items = [u'한국어', ' English']
|
items = [u'한국어', ' English']
|
||||||
|
|
||||||
@ -63,4 +64,4 @@ def test_dest_not_in_supported_languages(translator):
|
|||||||
args = ('Hello', 'zzz', 'en')
|
args = ('Hello', 'zzz', 'en')
|
||||||
|
|
||||||
with raises(ValueError):
|
with raises(ValueError):
|
||||||
translator.translate(*args)
|
translator.translate(*args)
|
||||||
|
@ -25,7 +25,12 @@ def test_acquire_token_ascii_less_than_2048(acquirer):
|
|||||||
|
|
||||||
|
|
||||||
def test_acquire_token_ascii_matches_special_condition(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)
|
result = acquirer.do(text)
|
||||||
|
|
||||||
@ -55,4 +60,4 @@ def test_map_lazy_return(acquirer):
|
|||||||
func = acquirer._lazy(value)
|
func = acquirer._lazy(value)
|
||||||
|
|
||||||
assert callable(func)
|
assert callable(func)
|
||||||
assert func() == value
|
assert func() == value
|
||||||
|
Loading…
Reference in New Issue
Block a user