Ejemplo n.º 1
0
def test_get_teams(date_response):
    """ Check to make sure we get a list of both teams for every game that day"""

    # Games for that date
    date_games = [
        ['ANA', 'MIN'], ['TOR', 'MTL'], ['NYR', 'PHI'], ['PIT', 'NSH'], ['T.B', 'CHI'], ['DET', 'VAN'],
        ['N.J', 'BUF'], ['ARI', 'OTT'], ['NYI', 'STL'], ['FLA', 'DAL'], ['CBJ', 'COL'], ['CAR', 'S.J']
    ]

    assert espn_pbp.get_teams(date_response) == date_games
Ejemplo n.º 2
0
    def get_espn_ids(self, games):
        """
        Get espn game ids for all games that day

        :param list games: games today

        :return: Games with corresponding espn game ids
        """
        # Get all espn info
        response = espn_pbp.get_espn_date(self.date)
        game_ids = espn_pbp.get_game_ids(response)
        espn_games = espn_pbp.get_teams(response)

        # Match up
        for i in range(len(games)):
            for j in range(len(espn_games)):
                if games[i]['home_team'] in espn_games[j] or games[i]['away_team'] in espn_games[j]:
                    games[i]['espn_id'] = game_ids[j]

        return games