Beispiel #1
0
def test_get_just_before_info_cancelled_race(boatrace_tools: PyJPBoatrace):
    # CANCELLED RACERS CASE #
    # preparation
    d = date(2019, 1, 26)
    dstr = d.strftime('%Y%m%d')
    stadium = 8
    race = 8
    # expectation
    expected = get_expected_json(
        f'expected_beforeinfo.rno={race}&jcd={stadium:02d}&hd={dstr}.json', )
    # actual
    actual = boatrace_tools.get_just_before_info(d, stadium, race)
    # assertion
    assert actual == expected
Beispiel #2
0
def test_get_just_before_info_missing_racer(boatrace_tools: PyJPBoatrace):
    # MISSING RACERS CASE #
    # preparation
    d = date(2020, 11, 29)
    dstr = d.strftime('%Y%m%d')
    stadium = 10
    race = 2
    # expectation
    expected = get_expected_json(
        f'expected_beforeinfo.rno={race}&jcd={stadium:02d}&hd={dstr}.json', )
    # actual
    actual = boatrace_tools.get_just_before_info(d, stadium, race)
    # assertion
    assert actual == expected
Beispiel #3
0
def test_get_just_before_info(boatrace_tools: PyJPBoatrace):
    # USUAL CASE #
    # preparation
    d = date(2020, 8, 25)
    dstr = d.strftime('%Y%m%d')
    stadium = 14
    race = 7
    # load true data
    expected = get_expected_json(
        f'expected_beforeinfo.rno={race}&jcd={stadium:02d}&hd={dstr}.json', )
    # actual data
    actual = boatrace_tools.get_just_before_info(d, stadium, race)
    # assertion
    assert actual == expected
Beispiel #4
0
def test_get_just_before_info_not_yet(mock_chrome):
    # NOT YET DISPLAYED CASE#
    # preparation: anything OK
    d = date(2020, 11, 29)
    stadium = 10
    race = 2
    # set mock
    mock_chrome.page_source = get_mock_html("not_yet_beforeinfo.html")

    # expectation
    expected = get_expected_json("expected_not_yet_beforeinfo.json")
    expected.update(date=d.strftime("%Y-%m-%d"), stadium=stadium, race=race)
    # actual
    pyjpboatrace = PyJPBoatrace(driver=mock_chrome)
    actual = pyjpboatrace.get_just_before_info(d, stadium, race)
    # assertion
    assert actual == expected
    # close
    mock_chrome.close()