def calculate_averages(team, game_list): average_stats = nfl_team_example_stats() for game in game_list: game_stats = nfl_local_data_handler().get_game( game['HomeTeam'], game['AwayTeam'], int(game['Week']), int(game['Season'])) average_stats.increment_game_count() average_stats.include_stats_in_average(team, game_stats) return average_stats
def test_example_has_right_data_size(self): """ example should be the size of both teams history + two for the score + any more for other items (e.g. DVOA, line, OU, weather... """ stats_for_example = nfl_team_example_stats() number_of_dvoa_stats = nfl_dvoa_stats.num_dvoa_stats number_of_stats_expected = \ len(stats_for_example.stats_to_average) * 2 number_of_stats_expected += number_of_dvoa_stats * 2 number_of_stats_expected += 2 # for expected score number_of_stats_expected += 2 # for home and away team number_of_stats_expected += 2 # for season and week example = nfl_example_maker('SF', 'SEA', 2014, 13) # print example.example number_of_stats_found = len(example.example_data_dict) self.assertEqual(number_of_stats_expected, number_of_stats_found)