Esempio n. 1
0
def test_match_id_with():
    f1 = Fixture(1, datetime.datetime(2015, 5, 3), 'end', 10, 'ABC', 30, 'XYZ',
                 Result(5, 1))

    f2 = Fixture(2, datetime.datetime(2016, 10, 20), 'end', 10, 'ABC', 15,
                 'XYZ', Result(5, 1))

    f3 = Fixture(3, datetime.datetime(2005, 8, 19), 'end', 10, 'ABC', 20,
                 'XYZ', Result(5, 1))

    fixtures = [f3, f1, f2]

    assert FixturesOperation.match_id_with(fixtures, 15) == 2
    assert FixturesOperation.match_id_with(fixtures, 5) == -1
Esempio n. 2
0
    def _download_h2h_fixtures(self):
        match_id = FixturesOperation.match_id_with(self.home_team.fixtures,
                                                   self.away_team.team_id)
        if match_id == -1:
            return []

        return FootballData.get_fixtures_h2h(match_id)
Esempio n. 3
0
def get_h2h_match_id(home_team_id,
                     away_team_id,
                     match_date=datetime.datetime.now()):
    home_team_fixtures = get_team_fixtures_all(home_team_id, match_date)
    return FixturesOperation.match_id_with(home_team_fixtures, away_team_id)