nidhal baccouri
commited on
Commit
·
ffa7560
1
Parent(s):
fd6b374
updated tests
Browse files
tests/test_google_trans.py
CHANGED
|
@@ -129,10 +129,6 @@ def google_translator():
|
|
| 129 |
"""
|
| 130 |
return GoogleTranslator(target='en')
|
| 131 |
|
| 132 |
-
def multiple_names_lang_checks():
|
| 133 |
-
assert GoogleTranslator(source='en', target='burMeSe').translate("Hello") == 'မင်္ဂလာပါ'
|
| 134 |
-
assert GoogleTranslator(source='en', target='Oriya').translate("What's up?") == 'କଣ ଚାଲିଛି?'
|
| 135 |
-
assert GoogleTranslator(source='en', target='kurManJi').translate("Nice is dice.") == 'Xweş xweş e.'
|
| 136 |
|
| 137 |
def test_random_tranlations_cases_multiple_names():
|
| 138 |
random_sample_size = 2
|
|
@@ -142,7 +138,6 @@ def test_random_tranlations_cases_multiple_names():
|
|
| 142 |
for lang, translation in random_subset_dict.items():
|
| 143 |
assert GoogleTranslator(source='en', target=lang).translate(test_text_standard) == translation
|
| 144 |
|
| 145 |
-
multiple_names_lang_checks()
|
| 146 |
|
| 147 |
def test_content(google_translator):
|
| 148 |
"""Sample pytest test function with the pytest fixture as an argument."""
|
|
@@ -152,7 +147,7 @@ def test_content(google_translator):
|
|
| 152 |
|
| 153 |
def test_abbreviations_and_languages_mapping():
|
| 154 |
for abb, lang in GOOGLE_CODES_TO_LANGUAGES.items():
|
| 155 |
-
if
|
| 156 |
g1 = GoogleTranslator(abb)
|
| 157 |
g2 = GoogleTranslator(lang)
|
| 158 |
assert g1._source == g2._source
|
|
@@ -184,8 +179,5 @@ def test_payload(google_translator):
|
|
| 184 |
with pytest.raises(exceptions.NotValidLength):
|
| 185 |
google_translator.translate("a"*5001)
|
| 186 |
|
| 187 |
-
#for _ in range(1):
|
| 188 |
-
#assert google_translator.translate(text='좋은') == "good"
|
| 189 |
-
|
| 190 |
def test_one_character_words():
|
| 191 |
assert GoogleTranslator(source='es', target='en').translate('o') == 'or'
|
|
|
|
| 129 |
"""
|
| 130 |
return GoogleTranslator(target='en')
|
| 131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
|
| 133 |
def test_random_tranlations_cases_multiple_names():
|
| 134 |
random_sample_size = 2
|
|
|
|
| 138 |
for lang, translation in random_subset_dict.items():
|
| 139 |
assert GoogleTranslator(source='en', target=lang).translate(test_text_standard) == translation
|
| 140 |
|
|
|
|
| 141 |
|
| 142 |
def test_content(google_translator):
|
| 143 |
"""Sample pytest test function with the pytest fixture as an argument."""
|
|
|
|
| 147 |
|
| 148 |
def test_abbreviations_and_languages_mapping():
|
| 149 |
for abb, lang in GOOGLE_CODES_TO_LANGUAGES.items():
|
| 150 |
+
if abb != 'en':
|
| 151 |
g1 = GoogleTranslator(abb)
|
| 152 |
g2 = GoogleTranslator(lang)
|
| 153 |
assert g1._source == g2._source
|
|
|
|
| 179 |
with pytest.raises(exceptions.NotValidLength):
|
| 180 |
google_translator.translate("a"*5001)
|
| 181 |
|
|
|
|
|
|
|
|
|
|
| 182 |
def test_one_character_words():
|
| 183 |
assert GoogleTranslator(source='es', target='en').translate('o') == 'or'
|