Sanjeeth commited on
Commit
dbb5aed
·
unverified ·
1 Parent(s): cc5ca08

Update test_app.py

Browse files
Files changed (1) hide show
  1. test_app.py +19 -11
test_app.py CHANGED
@@ -3,21 +3,29 @@ from app import translate
3
 
4
  class TestTranslationFunction(unittest.TestCase):
5
 
 
 
 
 
6
  def test_translate_to_french(self):
7
- result = translate("Hello", "French")
8
- self.assertIn("Bonjour", result, "Translation to French failed")
9
-
 
10
  def test_translate_to_german(self):
11
- result = translate("Hello", "German")
12
- self.assertIn("Hallo", result, "Translation to German failed")
13
-
 
14
  def test_translate_to_romanian(self):
15
- result = translate("Hello", "Romanian")
16
- self.assertTrue("Bună" in result or "Salut" in result, "Translation to Romanian failed")
 
17
 
18
  def test_unsupported_language(self):
19
- result = translate("Hello", "Spanish")
20
- self.assertEqual(result, "Sorry, this language is not supported.", "Unsupported language test failed")
 
21
 
22
- if __name__ == "__main__":
23
  unittest.main()
 
3
 
4
  class TestTranslationFunction(unittest.TestCase):
5
 
6
+ def setUp(self):
7
+ # Default model type to Local-Based for testing purposes
8
+ self.model_type = "Local-Based"
9
+
10
  def test_translate_to_french(self):
11
+ # Test translation to French using the Local-Based model
12
+ result = translate("Hello", "French", self.model_type)
13
+ self.assertEqual(result, "Bonjour")
14
+
15
  def test_translate_to_german(self):
16
+ # Test translation to German using the Local-Based model
17
+ result = translate("Hello", "German", self.model_type)
18
+ self.assertEqual(result, "Hallo")
19
+
20
  def test_translate_to_romanian(self):
21
+ # Test translation to Romanian using the Local-Based model
22
+ result = translate("Hello", "Romanian", self.model_type)
23
+ self.assertEqual(result, "Bună ziua")
24
 
25
  def test_unsupported_language(self):
26
+ # Test translation to unsupported language using the Local-Based model
27
+ result = translate("Hello", "Spanish", self.model_type)
28
+ self.assertEqual(result, "Sorry, this language is not supported.")
29
 
30
+ if __name__ == '__main__':
31
  unittest.main()