def test_given_method_name_when_correct_returns_happy(self): mood_factory = MoodAnalyserFactory() mood_object = mood_factory.return_mood_analyser_object( "mood_analyser", "MoodAnalyser", "I am in happy mood!") mood = mood_factory.invoke_methods(mood_object, "analyse_mood", "I am in happy mood") assert mood is "Happy"
def test_given_method_name_when_incorrect_returns_throws_exception(self): mood_factory = MoodAnalyserFactory() mood_object = mood_factory.return_mood_analyser_object( "mood_analyser", "MoodAnalyser", "I am in happy mood!") with pytest.raises(MoodAnalyserError) as e: mood = mood_factory.invoke_methods(mood_object, "InvalidMethiod", "I am in happy mood") assert mood is "Happy" assert str(e.value) == "INVALID_METHOD_EXCEPTION"