def problem3(): if check_doctest('get_word_sentiment', trends): return True has_sentiment_tests = ( ((trends.make_sentiment(0.3),), True), ((trends.make_sentiment(None),), False), ((trends.make_sentiment(-1),), True), ) sentiment_value_tests = ( ((trends.make_sentiment(-0.3),), -0.3), ((trends.make_sentiment(1),), 1), ((trends.make_sentiment(-1),), -1), ) if check_func(trends.has_sentiment, has_sentiment_tests): return True elif check_func(trends.sentiment_value, sentiment_value_tests): return True
def problem3(): if check_doctest('make_sentiment', trends): return True if check_doctest('get_word_sentiment', trends): return True has_sentiment_tests = ( ((trends.make_sentiment(0.3), ), True), ((trends.make_sentiment(None), ), False), ((trends.make_sentiment(-1), ), True), ) sentiment_value_tests = ( ((trends.make_sentiment(-0.3), ), -0.3), ((trends.make_sentiment(1), ), 1), ((trends.make_sentiment(-1), ), -1), ) if check_func(trends.has_sentiment, has_sentiment_tests): return True elif check_func(trends.sentiment_value, sentiment_value_tests): return True
def problem3(grades): """Test sentiment abstract data type.""" if check_doctest('make_sentiment', trends): return True if check_doctest('get_word_sentiment', trends): return True has_sentiment_tests = ( ((trends.make_sentiment(0.3),), True), ((trends.make_sentiment(None),), False), ((trends.make_sentiment(-1),), True), ) sentiment_value_tests = ( ((trends.make_sentiment(-0.3),), -0.3), ((trends.make_sentiment(1),), 1), ((trends.make_sentiment(-1),), -1), ) if check_func(trends.has_sentiment, has_sentiment_tests): return True elif check_func(trends.sentiment_value, sentiment_value_tests): return True