Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translation: Change system test. #7987

Merged
merged 3 commits into from
May 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions translate/tests/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(), u"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(), u"fünfzehn")

self.assertEqual(translations[2]["detectedSourceLanguage"], "es")
self.assertEqual(translations[2]["translatedText"].lower(), u"ich heiße jeff")
Expand Down