From 0c4da16f486ee45883735d648a5567c9592dbc96 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Wed, 15 May 2019 11:06:56 -0700 Subject: [PATCH 1/3] Change system test for translate. --- translate/tests/system.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/translate/tests/system.py b/translate/tests/system.py index 3daebe005134..840735b83def 100644 --- a/translate/tests/system.py +++ b/translate/tests/system.py @@ -54,19 +54,17 @@ def test_detect_language(self): self.assertEqual(detections[2]["language"], "fr") def test_translate(self): - values = ["hvala ti", "dankon", "Me llamo Jeff", "My name is Jeff"] + values = ["petnaest", "dek kvin", "Me llamo Jeff", "My name is Jeff"] translations = Config.CLIENT.translate( values, target_language="de", model="nmt" ) self.assertEqual(len(values), len(translations)) self.assertEqual(translations[0]["detectedSourceLanguage"].lower(), "hr") - self.assertEqual(translations[0]["translatedText"].lower(), "danke") + self.assertEqual(translations[0]["translatedText"].lower(), "fünfzehn") self.assertEqual(translations[1]["detectedSourceLanguage"], "eo") - # For some reason this is translated as both "dank" and "danke" - # in a seemingly non-deterministic way. - self.assertIn(translations[1]["translatedText"].lower(), ("dank", "danke")) + self.assertEqual(translations[1]["translatedText"].lower(), "fünfzehn") self.assertEqual(translations[2]["detectedSourceLanguage"], "es") self.assertEqual(translations[2]["translatedText"].lower(), u"ich heiße jeff") From d90da51cd0c896d59017dd85e620c0d4871ac797 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Wed, 15 May 2019 12:13:01 -0700 Subject: [PATCH 2/3] Fix unicode string. --- translate/tests/system.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translate/tests/system.py b/translate/tests/system.py index 840735b83def..06adc52f849d 100644 --- a/translate/tests/system.py +++ b/translate/tests/system.py @@ -61,10 +61,10 @@ def test_translate(self): self.assertEqual(len(values), len(translations)) self.assertEqual(translations[0]["detectedSourceLanguage"].lower(), "hr") - self.assertEqual(translations[0]["translatedText"].lower(), "fünfzehn") + self.assertEqual(translations[0]["translatedText"].lower(), u"f\xfcnfzehn") self.assertEqual(translations[1]["detectedSourceLanguage"], "eo") - self.assertEqual(translations[1]["translatedText"].lower(), "fünfzehn") + self.assertEqual(translations[1]["translatedText"].lower(), u"f\xfcnfzehn") self.assertEqual(translations[2]["detectedSourceLanguage"], "es") self.assertEqual(translations[2]["translatedText"].lower(), u"ich heiße jeff") From ca10ddfa409610200769d0921ed0116e9e6a3314 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Wed, 15 May 2019 15:31:56 -0700 Subject: [PATCH 3/3] =?UTF-8?q?Use=20character=20'=C3=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- translate/tests/system.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translate/tests/system.py b/translate/tests/system.py index 06adc52f849d..c586411b6111 100644 --- a/translate/tests/system.py +++ b/translate/tests/system.py @@ -61,10 +61,10 @@ def test_translate(self): self.assertEqual(len(values), len(translations)) self.assertEqual(translations[0]["detectedSourceLanguage"].lower(), "hr") - self.assertEqual(translations[0]["translatedText"].lower(), u"f\xfcnfzehn") + self.assertEqual(translations[0]["translatedText"].lower(), u"fünfzehn") self.assertEqual(translations[1]["detectedSourceLanguage"], "eo") - self.assertEqual(translations[1]["translatedText"].lower(), u"f\xfcnfzehn") + self.assertEqual(translations[1]["translatedText"].lower(), u"fünfzehn") self.assertEqual(translations[2]["detectedSourceLanguage"], "es") self.assertEqual(translations[2]["translatedText"].lower(), u"ich heiße jeff")