def test_get_race_result_with_race_name_param(self): """Testing to get the DataFrame with word parameters """ params = { netkeiba.url_params.PID: netkeiba.pid_list.RACE_LIST, netkeiba.url_params.WORD: "有馬記念" } df = netkeiba.get_race_result(params) assert not (df is None) assert type(df) == pd.DataFrame assert len(df) > 0 assert all(["有馬記念" in name for name in df["race_name"].to_list()])
def test_get_race_result_with_grade_param(self): """Testing to get the DataFrame with grade parameters """ params = { netkeiba.url_params.PID: netkeiba.pid_list.RACE_LIST, netkeiba.url_params.START_YEAR: 2019, netkeiba.url_params.GRADE: ["G2"] } df = netkeiba.get_race_result(params) assert not (df is None) assert type(df) == pd.DataFrame assert len(df) > 0 assert all(["2" in name for name in df["grade"].to_list()])
def test_get_race_result_with_track_param(self): """Testing to get the DataFrame with track parameters """ params = { netkeiba.url_params.PID: netkeiba.pid_list.RACE_LIST, netkeiba.url_params.START_YEAR: 2019, netkeiba.url_params.TRACK: ["DIRT"] } df = netkeiba.get_race_result(params) assert not (df is None) assert type(df) == pd.DataFrame assert len(df) > 0 assert all(["dirt" in name for name in df["race_category"].to_list()])
def test_get_race_result_with_start_year_params(self): """Testing to get the DataFrame with end-year parameters """ params = { netkeiba.url_params.PID: netkeiba.pid_list.RACE_LIST, netkeiba.url_params.START_YEAR: 2019, netkeiba.url_params.END_YEAR: 2019 } df = netkeiba.get_race_result(params) assert not (df is None) assert type(df) == pd.DataFrame assert len(df) > 0 assert any([2019 == dt.year for dt in df["date"].to_list()])
def test_get_race_result_with_distance_to_param(self): """Testing to get the DataFrame with distance_from parameters """ params = { netkeiba.url_params.PID: netkeiba.pid_list.RACE_LIST, netkeiba.url_params.START_YEAR: 2019, netkeiba.url_params.DISTANCE_TO: 2000 } df = netkeiba.get_race_result(params) assert not (df is None) assert type(df) == pd.DataFrame assert len(df) > 0 assert all([int(val) <= 2000 for val in df["distance"].to_list()])
def test_get_race_result_with_course_situation_param(self): """Testing to get the DataFrame with course situation parameters """ params = { netkeiba.url_params.PID: netkeiba.pid_list.RACE_LIST, netkeiba.url_params.START_YEAR: 2019, netkeiba.url_params.TRACK: ["DIRT"], netkeiba.url_params.COURSE_SITUATION: ["HEAVY_HOLDING"] } # [TODO] # In case of track is hurdle, possibility we get the SOFT_YIELDING data, # even if we set the search condition to HEAVY_HOLDING. # So, I check only dirt data. df = netkeiba.get_race_result(params) assert not (df is None) assert type(df) == pd.DataFrame assert len(df) > 0 assert all(["不" in name for name in df["course_situation"].to_list()])