def test_analyze_sentiment(capsys): result = analyze.analyze_sentiment("your face is really ugly and i hate it.") sentiment = result["documentSentiment"] assert sentiment["score"] < 0 assert sentiment["magnitude"] < 1 result = analyze.analyze_sentiment( "cheerio, mate - I greatly admire the pallor of your visage, and your angle of repose leaves little room for improvement." ) sentiment = result["documentSentiment"] assert sentiment["score"] > 0 assert sentiment["magnitude"] < 1
def test_analyze_sentiment(capsys): result = analyze.analyze_sentiment( 'your face is really ugly and i hate it.') sentiment = result['documentSentiment'] assert sentiment['polarity'] < 0 assert sentiment['magnitude'] < 1 result = analyze.analyze_sentiment( 'cheerio, mate - I greatly admire the pallor of your visage, and your ' 'angle of repose leaves little room for improvement.') sentiment = result['documentSentiment'] assert sentiment['polarity'] > 0 assert sentiment['magnitude'] < 1