def test_extend_targeted_task_list(): team = Team("team") task1 = Task("task1") task2 = Task("task2") team.extend_targeted_task_list([task1, task2]) assert team.targeted_task_list == [task1, task2] assert task1.allocated_team_list == [team] assert task2.allocated_team_list == [team]
def dummy_project(scope="function"): """dummy_project.""" # Components in Product c3 = Component("c3") c1 = Component("c1") c2 = Component("c2") c3.extend_child_component_list([c1, c2]) # Tasks in Workflow task1_1 = Task("task1_1", need_facility=True) task1_2 = Task("task1_2") task2_1 = Task("task2_1") task3 = Task("task3") task3.extend_input_task_list([task1_2, task2_1]) task1_2.append_input_task(task1_1) c1.extend_targeted_task_list([task1_1, task1_2]) c2.append_targeted_task(task2_1) c3.append_targeted_task(task3) # Facilities in workplace f1 = BaseFacility("f1") f1.workamount_skill_mean_map = { task1_1.name: 1.0, } # workplace.facility_list.append(f1) # Workplace in BaseOrganization workplace = BaseWorkplace("workplace", facility_list=[f1]) workplace.extend_targeted_task_list([task1_1, task1_2, task2_1, task3]) # Teams in Organization team = Team("team") team.extend_targeted_task_list([task1_1, task1_2, task2_1, task3]) # Workers in each Team w1 = Worker("w1", team_id=team.ID, cost_per_time=10.0) w1.workamount_skill_mean_map = { task1_1.name: 1.0, task1_2.name: 1.0, task2_1.name: 0.0, task3.name: 1.0, } w1.facility_skill_map = {f1.name: 1.0} team.worker_list.append(w1) w2 = Worker("w2", team_id=team.ID, cost_per_time=6.0) w2.workamount_skill_mean_map = { task1_1.name: 1.0, task1_2.name: 0.0, task2_1.name: 1.0, task3.name: 1.0, } w2.facility_skill_map = {f1.name: 1.0} team.worker_list.append(w2) # Project including Product, Workflow and Organization project = Project( init_datetime=datetime.datetime(2020, 4, 1, 8, 0, 0), unit_timedelta=datetime.timedelta(days=1), ) project.product = Product([c3, c1, c2]) project.workflow = Workflow([task1_1, task1_2, task2_1, task3]) project.organization = Organization(team_list=[team], workplace_list=[workplace]) return project