예제 #1
0
def test_tweet_is_correct():
    judger = Judger()
    # dummy blacklist class injection
    judger.blacklists = DummyBlacklists()
    for trend in sample_trends:
        should_tweet = judger.judge_whether_tweet(trend)

        if trend.get('name') == 'trend_A':
            assert should_tweet is False
        elif trend.get('name') == 'trend_B':
            assert should_tweet is False
        elif trend.get('name') == 'trend_C':
            assert should_tweet is True
        elif trend.get('name') == 'trend_D':
            assert should_tweet is True
        elif trend.get('name') == 'trend_E':
            assert should_tweet is True
        elif trend.get('name') == 'trend_F':
            assert should_tweet is False
        elif trend.get('name') == 'trend_blacklisted_A':
            assert should_tweet is False
예제 #2
0
def test_tweet_volume_lager_than_threshold():
    trend = {'name': 'dummy', 'tweet_volume': THRETHOLD + 1}
    judger = Judger()
    judger.blacklists = DummyBlacklists()
    assert judger.judge_whether_tweet(trend)
예제 #3
0
def test_tweet_volume_equals_threshold():
    trend = {'name': 'dummy', 'tweet_volume': THRETHOLD}
    judger = Judger()
    judger.blacklists = DummyBlacklists()
    assert not judger.judge_whether_tweet(trend)
    del judger