def test_three_renfuku( self, target_date: date, target_jyo: int, race_no: int, ex_three_renfukus: List[Tuple[int, int, int, float]], mocker, ): filename = ( f"odds_3fuku_" f"{target_date.strftime('%Y%m%d')}{target_jyo}{race_no}.html") filepath = FILEPATH / filename lx_content = GetParserContent.file_to_content(filepath, "lxml") mocker.patch.object(GetParserContent, "url_to_content", return_value=lx_content) oif = OddsInfoFactoryImpl() three_renfukus = oif._three_renfuku(target_date, target_jyo, race_no) three_renfukus = asdict(three_renfukus) for ex_three_renfuku in ex_three_renfukus: fst = ex_three_renfuku[0] snd = ex_three_renfuku[1] trd = ex_three_renfuku[2] expected = ex_three_renfuku[3] assert three_renfukus[f"comb_{fst}{snd}{trd}"] == expected
def test_getinfo( self, target_date: date, ex_names: list, ex_codes: list, ex_shinkos: list, ex_ed_races: list, mocker, ): filename = FILEPATH / f"ghp_{target_date.strftime('%Y%m%d')}.html" lx_content = GetParserContent.file_to_content(filename, "lxml") mocker.patch.object(GetParserContent, "url_to_content", return_value=lx_content) rif = RaceInfoFactoryImpl() holdrace_info_itr = rif.getinfo(target_date=target_date) names = list() codes = list() shinkos = list() ed_races = list() for hri in holdrace_info_itr: assert hri.date == target_date names.append(hri.jyo_name) codes.append(hri.jyo_cd) shinkos.append(hri.shinko) ed_races.append(hri.ed_race_no) assert names == ex_names assert codes == ex_codes assert shinkos == ex_shinkos assert ed_races == ex_ed_races
def test_tansho( self, target_date: date, target_jyo: int, race_no: int, ex_tanshos: List[Tuple[int, float]], mocker, ): filename = ( f"odds_1tan_" f"{target_date.strftime('%Y%m%d')}{target_jyo}{race_no}.html") filepath = FILEPATH / filename lx_content = GetParserContent.file_to_content(filepath, "lxml") mocker.patch.object(GetParserContent, "url_to_content", return_value=lx_content) oif = OddsInfoFactoryImpl() tanshos = oif._tansho(target_date, target_jyo, race_no) tanshos = asdict(tanshos) for ex_tansho in ex_tanshos: fst = ex_tansho[0] expected = ex_tansho[1] assert tanshos[f"comb_{fst}"] == expected
def test_raceinfo( self, target_date: date, target_jyo: int, race_no: int, ex_common: ProgramCommonInfo, ex_p1: ProgramPlayerInfo, ex_p2: ProgramPlayerInfo, mocker, ): filepath = ( FILEPATH / f"pro_{target_date.strftime('%Y%m%d')}{target_jyo}{race_no}.html") lx_content = GetParserContent.file_to_content(filepath, "lxml") mocker.patch.object(GetParserContent, "url_to_content", return_value=lx_content) pif = ProgramInfoFactoryImpl() programinfo = pif._raceinfo(target_date, target_jyo, race_no) assert programinfo.common == ex_common assert programinfo.players[ex_p1.waku - 1] == ex_p1 assert programinfo.players[ex_p2.waku - 1] == ex_p2
def test_raceinfo( self, target_date: date, target_jyo: int, race_no: int, ex_common: WeatherInfo, ex_players: List[ChokuzenPlayerInfo], mocker, ): filename = ( f"choku_{target_date.strftime('%Y%m%d')}{target_jyo}{race_no}.html" ) filepath = FILEPATH / filename lx_content = GetParserContent.file_to_content(filepath, "lxml") mocker.patch.object( GetParserContent, "url_to_content", return_value=lx_content ) chif = ChokuzenInfoFactoryImpl() chokuinfo = chif._raceinfo(target_date, target_jyo, race_no) assert chokuinfo.common == ex_common for ex_p in ex_players: assert chokuinfo.players[ex_p.waku - 1] == ex_p
def test_raceinfo( self, target_date: date, target_jyo: int, race_no: int, ex_common: ResultCommonInfo, ex_players: List[ResultPlayerInfo], mocker, ): filepath = ( FILEPATH / f"res_{target_date.strftime('%Y%m%d')}{target_jyo}{race_no}.html" ) lx_content = GetParserContent.file_to_content(filepath, "lxml") mocker.patch.object( GetParserContent, "url_to_content", return_value=lx_content ) rif = ResultInfoFactoryImpl() resinfo = rif._raceinfo(target_date, target_jyo, race_no) assert resinfo.common == ex_common for ex_p in ex_players: assert resinfo.players[ex_p.waku - 1] == ex_p