示例#1
0
def test_generate_headline_draw():
    matches = []
    new_match = match.Match(date.today(), "PREM", "1", "MAN U", 'H')
    new_match.set_result_data('D', (1, 1))
    matches.append(new_match)
    selected_match = match.choose_random_match(matches)
    assert onthisday.generate_headline(selected_match).find("drew") != -1
def get_otd_headline(date_of_interest=date.today()):
    """ gets the headline for today's match

        date_of_interest is the date of the match, defaults to today's date
        returns the generated headline
    """
    all_matches = match.load_matches_data(date_of_interest, config.DATA_INPUT)
    selected_match = match.choose_random_match(all_matches)
    headline = generate_headline(selected_match)
    return headline
示例#3
0
def test_generate_headline_nogame():
    matches = []
    selected_match = match.choose_random_match(matches)
    assert onthisday.generate_headline(selected_match).find("No game") != -1