<reponame>marcosmuto/xzceb-flask_eng_fr
import unittest
from machinetranslation import translator

class TestTranslator(unittest.TestCase):

    def test_null_french_to_english(self):
        with self.assertRaises(ValueError) as context:
            translator.french_to_english(None)
        self.assertEqual('text must be provided', str(context.exception))

    def test_null_english_to_french(self):
        with self.assertRaises(ValueError) as context:
            translator.english_to_french(None)
        self.assertEqual('text must be provided', str(context.exception))

    def test_translation_french_to_english(self):
        self.assertEqual(translator.french_to_english('Bonjour'), 'Hello')

    def test_translation_english_to_french(self):
        self.assertEqual(translator.english_to_french('Hello'), 'Bonjour')

if __name__ == '__main__':
    unittest.main()
import unittest
from machinetranslation import translator

class TestTranslator(unittest.TestCase):

    def test_null_french_to_english(self):
        with self.assertRaises(ValueError) as context:
            translator.french_to_english(None)
        self.assertEqual('text must be provided', str(context.exception))

    def test_null_english_to_french(self):
        with self.assertRaises(ValueError) as context:
            translator.english_to_french(None)
        self.assertEqual('text must be provided', str(context.exception))

    def test_translation_french_to_english(self):
        self.assertEqual(translator.french_to_english('Bonjour'), 'Hello')

    def test_translation_english_to_french(self):
        self.assertEqual(translator.english_to_french('Hello'), 'Bonjour')

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