コード例 #1
0
ファイル: test_penalty.py プロジェクト: vmck/acs-interface
def test_upload_deadline_1sec_after():
    penalty_score = scoring.compute_penalty(
        "2019.12.10 23:55:01",
        "2019.12.05 23:55:00",
        DAILY_PENALTIES,
    )
    assert penalty_score == 6
コード例 #2
0
ファイル: test_penalty.py プロジェクト: vmck/acs-interface
def test_no_holiday():
    # No late penaly
    penalty_score = scoring.compute_penalty(
        "2019.12.04 10:00:00",
        "2019.12.05 23:55:00",
        DAILY_PENALTIES,
    )
    assert penalty_score == 0
コード例 #3
0
ファイル: test_penalty.py プロジェクト: vmck/acs-interface
def test_over_no_days():
    # over the number of days of penalyt
    penalty_score = scoring.compute_penalty(
        "2019.12.15 10:55:01",
        "2019.12.05 23:55:00",
        DAILY_PENALTIES,
    )
    assert penalty_score == 7
コード例 #4
0
ファイル: test_penalty.py プロジェクト: vmck/acs-interface
def test_hard_deadline():
    # hard deadline
    penalty_score = scoring.compute_penalty(
        "2019.12.12 10:00:00",
        "2019.12.05 23:55:00",
        DAILY_PENALTIES,
    )
    assert penalty_score == 7
コード例 #5
0
ファイル: test_penalty.py プロジェクト: vmck/acs-interface
def test_rand_soft_hard():
    # random date between soft and hard deadline
    penalty_score = scoring.compute_penalty(
        "2019.12.10 10:00:00",
        "2019.12.05 23:55:00",
        DAILY_PENALTIES,
    )
    assert penalty_score == 5
コード例 #6
0
ファイル: test_penalty.py プロジェクト: vmck/acs-interface
def test_soft_deadline():
    # soft deadline
    penalty_score = scoring.compute_penalty(
        "2019.12.05 23:55:01",
        "2019.12.05 23:55:00",
        DAILY_PENALTIES,
    )
    assert penalty_score == 1
コード例 #7
0
ファイル: test_penalty.py プロジェクト: vmck/acs-interface
def test_holiday_at_start_more_24h():
    penalty_score = scoring.compute_penalty(
        "2019.12.10 10:00:00",
        "2019.12.05 23:55:00",
        DAILY_PENALTIES,
        ["2019.12.06 00:00:00"],
        ["2019.12.09 10:00:00"],
    )
    assert penalty_score == 2
コード例 #8
0
ファイル: test_penalty.py プロジェクト: vmck/acs-interface
def test_holiday_multiple():
    penalty_score = scoring.compute_penalty(
        "2019.12.15 10:00:00",
        "2019.12.05 23:55:00",
        DAILY_PENALTIES,
        ["2019.12.07 00:00:00", "2019.12.11 00:00:00"],
        ["2019.12.09 00:00:00", "2019.12.13 00:00:00"],
    )
    assert penalty_score == 6
コード例 #9
0
ファイル: test_penalty.py プロジェクト: vmck/acs-interface
def test_holiday_at_end():
    penalty_score = scoring.compute_penalty(
        "2019.12.12 00:00:01",
        "2019.12.05 23:55:00",
        DAILY_PENALTIES,
        ["2019.12.11 00:00:00"],
        ["2019.12.12 00:00:00"],
    )
    assert penalty_score == 6
コード例 #10
0
ファイル: test_penalty.py プロジェクト: vmck/acs-interface
def test_holiday_in_middle_or_end():
    penalty_score = scoring.compute_penalty(
        "2019.12.10 10:00:00",
        "2019.12.05 23:55:00",
        DAILY_PENALTIES,
        ["2019.12.07 00:00:00"],
        ["2019.12.09 00:00:00"],
    )
    assert penalty_score == 3
コード例 #11
0
ファイル: test_penalty.py プロジェクト: vmck/acs-interface
def test_holiday_before_deadline():
    penalty_score = scoring.compute_penalty(
        "2019.12.10 10:00:00",
        "2019.12.05 23:55:00",
        DAILY_PENALTIES,
        ["2019.12.04 00:00:00"],
        ["2019.12.09 23:55:00"],
    )
    assert penalty_score == 1
コード例 #12
0
def test_no_holiday():
    # No late penaly
    penalty_score = scoring.compute_penalty(
        "2019.12.04 10:00:00",
        "2019.12.05 23:55:00",
        DAILY_PENALTIES,
    )
    assert penalty_score == 0

    # random date between soft and hard deadline
    penalty_score = scoring.compute_penalty(
        "2019.12.10 10:00:00",
        "2019.12.05 23:55:00",
        DAILY_PENALTIES,
    )
    assert penalty_score == 5

    # soft deadline
    penalty_score = scoring.compute_penalty(
        "2019.12.05 23:55:01",
        "2019.12.05 23:55:00",
        DAILY_PENALTIES,
    )
    assert penalty_score == 1

    # over the number of days of penalyt
    penalty_score = scoring.compute_penalty(
        "2019.12.15 10:55:01",
        "2019.12.05 23:55:00",
        DAILY_PENALTIES,
    )
    assert penalty_score == 7

    # hard deadline
    penalty_score = scoring.compute_penalty(
        "2019.12.12 10:00:00",
        "2019.12.05 23:55:00",
        DAILY_PENALTIES,
    )
    assert penalty_score == 7

    penalty_score = scoring.compute_penalty(
        "2019.12.10 23:55:00",
        "2019.12.05 23:55:00",
        DAILY_PENALTIES,
    )
    assert penalty_score == 5

    penalty_score = scoring.compute_penalty(
        "2019.12.10 23:55:01",
        "2019.12.05 23:55:00",
        DAILY_PENALTIES,
    )
    assert penalty_score == 6