def test_add_labor_cost(): factory = BaseFactory("factory") w1 = BaseFacility("w1", cost_per_time=10.0) w2 = BaseFacility("w2", cost_per_time=5.0) factory.facility_list = [w2, w1] w1.state = BaseFacilityState.WORKING w2.state = BaseFacilityState.FREE factory.add_labor_cost() assert w1.cost_list == [10.0] assert w2.cost_list == [0.0] assert factory.cost_list == [10.0] factory.add_labor_cost(only_working=False) assert factory.cost_list == [10.0, 15.0] assert w1.cost_list == [10.0, 10.0] assert w2.cost_list == [0.0, 5.0]
def test_add_labor_cost(): """test_add_labor_cost.""" workplace = BaseWorkplace("workplace") w1 = BaseFacility("w1", cost_per_time=10.0) w2 = BaseFacility("w2", cost_per_time=5.0) workplace.facility_list = [w2, w1] w1.state = BaseFacilityState.WORKING w2.state = BaseFacilityState.FREE workplace.add_labor_cost() assert w1.cost_list == [10.0] assert w2.cost_list == [0.0] assert workplace.cost_list == [10.0] workplace.add_labor_cost(only_working=False) assert workplace.cost_list == [10.0, 15.0] assert w1.cost_list == [10.0, 10.0] assert w2.cost_list == [0.0, 5.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 == []
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 == []
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 == []
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 == []