Skip to content

armgit / txtai

Public Imported from GitHub
0

💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows

Reduce test complexity to work with memory available on GitHub actions

davidmezzetti4907be4346da
diff --git a/test/python/testtranslation.py b/test/python/testtranslation.py
index 86c12f3b..68048bad 100644
--- a/test/python/testtranslation.py
+++ b/test/python/testtranslation.py
@@ -20,12 +20,20 @@ class TestTranslation(unittest.TestCase):
translate = Translation()
+ # Validate translation from English - Spanish
text = "This is a test translation into Spanish"
translation = translate(text, "es")
-
- # Validate translation text
self.assertEqual(translation, "Esta es una traducción de prueba al español")
+ # Validate no translation
+ translation = translate("Esta es una traducción de prueba al español", "es")
+ self.assertEqual(text, translation)
+
+ # Validate long translation text
+ text = "This is a test translation to Spanish. " * 100
+ translation = translate(text, "es")
+ self.assertIsNotNone(translation)
+
@unittest.skipIf(os.name == "nt", "M2M100 skipped on Windows")
def testM2M100Translation(self):
"""
@@ -38,29 +46,3 @@ class TestTranslation(unittest.TestCase):
# Validate translation text
self.assertEqual(text, "Ovo je testni prijevod na hrvatski")
-
- def testNoTranslation(self):
- """
- Tests translation skipped when text already in destination language
- """
-
- translate = Translation()
-
- text = "This is a test translation to English"
- translation = translate(text, "en")
-
- # Validate no translation
- self.assertEqual(text, translation)
-
- def testLongTranslation(self):
- """
- Tests a translation longer than max tokenization length.
- """
-
- translate = Translation()
-
- text = "This is a test translation to Spanish. " * 100
- translation = translate(text, "es")
-
- # Validate translation text
- self.assertIsNotNone(translation)