Ejemplo n.º 1
0
def test_get_work_amount_skill_progress():
    """test_get_work_amount_skill_progress."""
    w = BaseFacility("w1", "----")
    w.workamount_skill_mean_map = {"task1": 1.0, "task2": 0.0}
    assert w.get_work_amount_skill_progress("task3") == 0.0
    assert w.get_work_amount_skill_progress("task2") == 0.0
    with pytest.raises(ZeroDivisionError):
        assert w.get_work_amount_skill_progress("task1") == 1.0

    task1 = BaseTask("task1")
    task1.state = BaseTaskState.NONE
    w.assigned_task_list = [task1]
    with pytest.raises(ZeroDivisionError):
        assert w.get_work_amount_skill_progress("task1") == 1.0
    task1.state = BaseTaskState.READY
    with pytest.raises(ZeroDivisionError):
        assert w.get_work_amount_skill_progress("task1") == 1.0
    task1.state = BaseTaskState.WORKING_ADDITIONALLY
    assert w.get_work_amount_skill_progress("task1") == 1.0
    task1.state = BaseTaskState.FINISHED
    with pytest.raises(ZeroDivisionError):
        assert w.get_work_amount_skill_progress("task1") == 1.0
    task1.state = BaseTaskState.WORKING
    assert w.get_work_amount_skill_progress("task1") == 1.0

    w.workamount_skill_sd_map["task1"] = 0.1
    w.get_work_amount_skill_progress("task1", seed=1234)  # seed test

    task2 = BaseTask("task2")
    task2.state = BaseTaskState.NONE
    w.assigned_task_list.append(task2)
    w.workamount_skill_sd_map["task1"] = 0.0
    assert w.get_work_amount_skill_progress("task1") == 1.0
    task2.state = BaseTaskState.WORKING
    assert w.get_work_amount_skill_progress("task1") == 0.5
Ejemplo n.º 2
0
def test_initialize():
    """test_initialize."""
    team = BaseWorkplace("team")
    w = BaseFacility("w1", workplace_id=team.ID)
    w.state = BaseFacilityState.WORKING
    w.cost_list = [9.0, 7.2]
    w.assigned_task_list = [BaseTask("task")]
    w.initialize()
    assert w.state == BaseFacilityState.FREE
    assert w.cost_list == []
    assert w.assigned_task_list == []
Ejemplo n.º 3
0
def test_initialize():
    team = BaseFactory("team")
    w = BaseFacility("w1", factory_id=team.ID)
    w.state = BaseFacilityState.WORKING
    w.cost_list = [9.0, 7.2]
    w.start_time_list = [0]
    w.finish_time_list = [1]
    w.assigned_task_list = [BaseTask("task")]
    w.initialize()
    assert w.state == BaseFacilityState.FREE
    assert w.cost_list == []
    assert w.start_time_list == []
    assert w.finish_time_list == []
    assert w.assigned_task_list == []
Ejemplo n.º 4
0
def test_initialize():
    """test_initialize."""
    workplace = BaseWorkplace("workplace")
    workplace.cost_list = [9.0, 7.2]
    w = BaseFacility("w1")
    workplace.facility_list = [w]
    w.state = BaseFacilityState.WORKING
    w.cost_list = [9.0, 7.2]
    w.assigned_task_list = [BaseTask("task")]
    workplace.initialize()
    assert workplace.cost_list == []
    assert w.state == BaseFacilityState.FREE
    assert w.cost_list == []
    assert w.assigned_task_list == []
Ejemplo n.º 5
0
def test_initialize():
    factory = BaseFactory("factory")
    factory.cost_list = [9.0, 7.2]
    w = BaseFacility("w1")
    factory.facility_list = [w]
    w.state = BaseFacilityState.WORKING
    w.cost_list = [9.0, 7.2]
    w.start_time_list = [0]
    w.finish_time_list = [1]
    w.assigned_task_list = [BaseTask("task")]
    factory.initialize()
    assert factory.cost_list == []
    assert w.state == BaseFacilityState.FREE
    assert w.cost_list == []
    assert w.start_time_list == []
    assert w.finish_time_list == []
    assert w.assigned_task_list == []