コード例 #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
コード例 #2
0
def test_cupfinal_winners():
    new_match = match.Match(date(2019, 1, 1), "FA Cup", "Final", "MAN U", 'H')
    new_match.set_result_data('W', (5, 1))
    assert onthisday.generate_headline(new_match).find("are champions!") != -1
コード例 #3
0
def test_generate_headline_aet():
    new_match = match.Match(date(2019, 1, 1), "PREM", "", "MAN U", 'H')
    new_match.set_result_data('W', (4, 3), "AET", "")
    assert onthisday.generate_headline(new_match).find("after extra time") > -1
コード例 #4
0
def test_generate_headline_pst():
    new_match = match.Match(date(2019, 1, 1), "PREM", "", "MAN U", 'H')
    new_match.set_result_data('W', (4, 3), "PST", "")
    assert onthisday.generate_headline(new_match).find("penalties") > -1
コード例 #5
0
def test_generate_headline_nogame():
    matches = []
    selected_match = match.choose_random_match(matches)
    assert onthisday.generate_headline(selected_match).find("No game") != -1