def test_translate_1(): """Tests translation where source language and target language are identical.""" actual = translate('This is a test', 1, 'en', 'en')['translated_text'] expected = 'This is a test' assert actual == expected
def test_translate_4(): """Tests translation where an invalid target language is given.""" with pytest.raises(HTTPException): translate('The cake was a lie', 1, 'en', 'unknown')
def test_translate_2(): """Tests translation where an empty text is given.""" with pytest.raises(HTTPException): translate('', 1, 'en', 'ko')