Skip to content

Commit

Permalink
Update test_translator.py
Browse files Browse the repository at this point in the history
  • Loading branch information
sioaeko committed Jun 30, 2024
1 parent a23590f commit a3bab78
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/test_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@

class TestTranslator(unittest.TestCase):

def test_translation(self):
result = translate("Hello, world!", "en", "fr")
self.assertEqual(result, "Bonjour, le monde!")
def test_english_to_french(self):
result = translate("Hello, world!", "eng_Latn", "fra_Latn")
self.assertIn("Bonjour", result)

def test_french_to_english(self):
result = translate("Bonjour le monde", "fra_Latn", "eng_Latn")
self.assertIn("Hello", result)

def test_error_handling(self):
result = translate("Test", "invalid_lang", "eng_Latn")
self.assertIn("error", result.lower())

if __name__ == '__main__':
unittest.main()

0 comments on commit a3bab78

Please sign in to comment.