def test_results(_get): _get().content = open('tests/fixtures/schedule.html').read() results, _ = baseball.schedule('WEST', 'http://example.com') assert_equals(results, [ baseball.Game('LA Dodgers', april(1, 20, 5), False, False, '4-0'), baseball.Game('LA Dodgers', april(2, 20, 5), False, True, '3-0'), baseball.Game('LA Dodgers', april(3, 20, 5), False, True, '5-3'), baseball.Game('St. Louis', april(5, 20, 5), True, True, '1-0'), ])
def test_upcoming(_get): _get().content = open('tests/fixtures/schedule.html').read() _, upcoming = baseball.schedule('WEST', 'http://example.com') assert_equals(upcoming, [ baseball.Game('St. Louis', april(6, 20, 5), True, None, '0-0'), baseball.Game('St. Louis', april(7, 20, 5), True, None, '0-0'), baseball.Game('Colorado', april(9, 2, 15), True, None, '0-0'), baseball.Game('Colorado', april(10, 2, 15), True, None, '0-0'), baseball.Game('Colorado', april(10, 19, 45), True, None, '0-0'), ])
def test_upcoming_with_skipped(_get): webpage = open('tests/fixtures/bluejays_with_double_header.html').read() _get().content = webpage _, upcoming = baseball.schedule('WEST', 'http://example.com') print(upcoming[0].opponent) assert_equals(upcoming, [ baseball.Result('Toronto', june(4, 19, 15), True, None, '0-0'), baseball.Result('Toronto', june(5, 12, 45), True, None, '0-0'), baseball.Result('Arizona', june(7, 18, 40), False, None, '0-0'), baseball.Result('Arizona', june(8, 19, 10), False, None, '0-0'), baseball.Result('Arizona', june(9, 13, 10), False, None, '0-0'), ])