def test_game_status_timezones(): test_tstamp = dt.today() + timedelta(hours=-6) game_ongoing_date = dt.strftime(test_tstamp, "%m/%d/%y") game_ongoing_time = dt.strftime(test_tstamp, "%I:%M %p") + " CST" test_game = AUDLclasses.Game(game_ongoing_date, game_ongoing_time + " EST", game_ts(game_ongoing_date, game_ongoing_time), 'Cincinnati Revolution', 'Madison Radicals') test_game.set_status() assert 2 == test_game.status, test_game.status test_tstamp = dt.today() + timedelta(hours=-6) game_ongoing_date = dt.strftime(test_tstamp, "%m/%d/%y") game_ongoing_time = dt.strftime(test_tstamp, "%I:%M %p") + " PST" test_game = AUDLclasses.Game(game_ongoing_date, game_ongoing_time, game_ts(game_ongoing_date, game_ongoing_time), 'Cincinnati Revolution', 'Madison Radicals') test_game.set_status() assert 1 == test_game.status, test_game.status
def test_game_attrs(): test_game = AUDLclasses.Game("4/12/14", "3:00 PM", '2014', 'Toronto Rush', 'DC Breeze') assert type(test_game.time) is str assert type(test_game.Finished) is bool assert type(test_game.Score) is list assert type(test_game.Location) is str assert type(test_game.home_team) is str assert type(test_game.away_team) is str assert type(test_game.home_team) is str assert type(test_game.away_team) is str assert type(test_game.home_team) is str assert type(test_game.away_team) is str assert type(test_game.Home_stats) is dict assert type(test_game.Away_stats) is dict assert type(test_game.Goals) is dict assert type(test_game.Quarter) is int
def test_game_set_status_final(): d = '4/12/14' t = '7:00 PM EST' test_game = AUDLclasses.Game(d, t, game_ts(d, t), 'Cincinnati Revolution', 'Madison Radicals') test_game.set_status() assert 2 == test_game.status, test_game.status test_tstamp = dt.today() + timedelta(days=-1) game_over_date = dt.strftime(test_tstamp, "%m/%d/%y") test_game = AUDLclasses.Game(game_over_date, t, game_ts(game_over_date, t), 'Cincinnati Revolution', 'Madison Radicals') test_game.set_status() assert 2 == test_game.status, test_game.status
def team_record_setup(): test_team = AUDLclasses.Team(None, 224002, "Radicals", "Madison") test_team.Games = {} test_team.Games['4/10/13'] = AUDLclasses.Game('4/10/13', "7:00 EST", "2013", "Madison Radicals", "Minnesota Wind Chill") test_team.Games['4/10/13'].home_score = 23 test_team.Games['4/10/13'].away_score = 22 test_team.Games['4/17/13'] = AUDLclasses.Game('4/17/13', "7:00 EST", "2013", "Madison Radicals", "Minnesota Wind Chill") test_team.Games['4/17/13'].home_score = 23 test_team.Games['4/17/13'].away_score = 22 test_team.Games['4/24/13'] = AUDLclasses.Game('4/24/13', "7:00 EST", "2013", "Madison Radicals", "Minnesota Wind Chill") test_team.Games['4/24/13'].home_score = 23 test_team.Games['4/24/13'].away_score = 25 test_team.Games['5/1/13'] = AUDLclasses.Game('5/1/13', "7:00 EST", "2013", "Madison Radicals", "Minnesota Wind Chill") test_team.Games['5/1/13'].home_score = 23 test_team.Games['5/1/13'].away_score = 25 test_team.Games['5/8/13'] = AUDLclasses.Game('5/8/13', "7:00 EST", "2013", "Madison Radicals", "Minnesota Wind Chill") test_team.Games['5/8/13'].home_score = 28 test_team.Games['5/8/13'].away_score = 25 return test_team
def test_match_games(): game_dict = [{ "teamId": "5182111044599808", "gameId": "game-8ECA8C1D-6968-4FD0-A361-DE4EFF20203D", "opponentName": "Cincinnati Revolution", "tournamentName": "", "gamePoint": 1000, "wind": { "mph": 0, "degrees": -1 }, "timestamp": "2014-04-12 19:26", "date": "Sat, 4/12", "time": "7:26", "msSinceEpoch": 1397330760000, "ours": 25, "theirs": 16, "timeoutDetailsJson": "{\"takenSecondHalf\":2,\"quotaPerHalf\":2,\"takenFirstHalf\":2,\"quotaFloaters\":0}" }, { "teamId": "5182111044599808", "gameId": "game-47F12B4E-52A2-4AC4-8047-FAC93845A51B", "opponentName": "Indianapolis alleyCats", "tournamentName": "", "gamePoint": 1000, "wind": { "mph": 0, "degrees": -1 }, "timestamp": "2014-04-13 15:42", "date": "Sun, 4/13", "time": "3:42", "msSinceEpoch": 1397403720000, "ours": 26, "theirs": 21, "timeoutDetailsJson": "{\"takenSecondHalf\":2,\"quotaPerHalf\":2,\"takenFirstHalf\":2,\"quotaFloaters\":0}" }] d = "4/12/14" t = "7:00 PM EST" test_game = AUDLclasses.Game(d, t, game_ts(d, t), 'Cincinnati Revolution', 'Madison Radicals') test_game.match_game(game_dict, False) assert test_game.home_score == 16, test_game.home_score assert test_game.away_score == 25, test_game.away_score