- assert isinstance(self.proc2.id_, int)
- assert isinstance(self.proc3.id_, int)
- steps_proc1: list[tuple[int | None, int, int | None]] = []
- add_step(self.proc1, steps_proc1, (None, self.proc2.id_, None), 1)
- p_1_dict: dict[int, ProcessStepsNode] = {}
- p_1_dict[1] = ProcessStepsNode(self.proc2, None, True, {}, False)
- self.assertEqual(self.proc1.get_steps(self.db_conn, None), p_1_dict)
- add_step(self.proc1, steps_proc1, (None, self.proc3.id_, None), 2)
- step_2 = self.proc1.explicit_steps[-1]
- assert isinstance(step_2.id_, int)
- p_1_dict[2] = ProcessStepsNode(self.proc3, None, True, {}, False)
- self.assertEqual(self.proc1.get_steps(self.db_conn, None), p_1_dict)
- steps_proc2: list[tuple[int | None, int, int | None]] = []
- add_step(self.proc2, steps_proc2, (None, self.proc3.id_, None), 3)
- p_1_dict[1].steps[3] = ProcessStepsNode(self.proc3, None,
- False, {}, False)
- self.assertEqual(self.proc1.get_steps(self.db_conn, None), p_1_dict)
- add_step(self.proc1, steps_proc1, (None, self.proc2.id_, step_2.id_),
- 4)
- step_3 = ProcessStepsNode(self.proc3, None, False, {}, True)
- p_1_dict[2].steps[4] = ProcessStepsNode(self.proc2, step_2.id_, True,
- {3: step_3}, False)
- self.assertEqual(self.proc1.get_steps(self.db_conn, None), p_1_dict)
- add_step(self.proc1, steps_proc1, (None, self.proc3.id_, 999), 5)
- p_1_dict[5] = ProcessStepsNode(self.proc3, None, True, {}, False)
- self.assertEqual(self.proc1.get_steps(self.db_conn, None), p_1_dict)
- add_step(self.proc1, steps_proc1, (None, self.proc3.id_, 3), 6)
- p_1_dict[6] = ProcessStepsNode(self.proc3, None, True, {}, False)
- self.assertEqual(self.proc1.get_steps(self.db_conn, None),
- p_1_dict)
- self.assertEqual(self.proc1.used_as_step_by(self.db_conn),
- [])
- self.assertEqual(self.proc2.used_as_step_by(self.db_conn),
- [self.proc1])
- self.assertEqual(self.proc3.used_as_step_by(self.db_conn),
- [self.proc1, self.proc2])
+ p1, p2, p3 = self.three_processes()
+ assert isinstance(p1.id_, int)
+ assert isinstance(p2.id_, int)
+ assert isinstance(p3.id_, int)
+ steps_p1: list[tuple[int | None, int, int | None]] = []
+ add_step(p1, steps_p1, (None, p2.id_, None), 1)
+ p1_dict: dict[int, ProcessStepsNode] = {}
+ p1_dict[1] = ProcessStepsNode(p2, None, True, {}, False)
+ self.assertEqual(p1.get_steps(self.db_conn, None), p1_dict)
+ add_step(p1, steps_p1, (None, p3.id_, None), 2)
+ step_2 = p1.explicit_steps[-1]
+ p1_dict[2] = ProcessStepsNode(p3, None, True, {}, False)
+ self.assertEqual(p1.get_steps(self.db_conn, None), p1_dict)
+ steps_p2: list[tuple[int | None, int, int | None]] = []
+ add_step(p2, steps_p2, (None, p3.id_, None), 3)
+ p1_dict[1].steps[3] = ProcessStepsNode(p3, None, False, {}, False)
+ self.assertEqual(p1.get_steps(self.db_conn, None), p1_dict)
+ add_step(p1, steps_p1, (None, p2.id_, step_2.id_), 4)
+ step_3 = ProcessStepsNode(p3, None, False, {}, True)
+ p1_dict[2].steps[4] = ProcessStepsNode(p2, step_2.id_, True,
+ {3: step_3}, False)
+ self.assertEqual(p1.get_steps(self.db_conn, None), p1_dict)
+ add_step(p1, steps_p1, (None, p3.id_, 999), 5)
+ p1_dict[5] = ProcessStepsNode(p3, None, True, {}, False)
+ self.assertEqual(p1.get_steps(self.db_conn, None), p1_dict)
+ add_step(p1, steps_p1, (None, p3.id_, 3), 6)
+ p1_dict[6] = ProcessStepsNode(p3, None, True, {}, False)
+ self.assertEqual(p1.get_steps(self.db_conn, None), p1_dict)
+ self.assertEqual(p1.used_as_step_by(self.db_conn), [])
+ self.assertEqual(p2.used_as_step_by(self.db_conn), [p1])
+ self.assertEqual(p3.used_as_step_by(self.db_conn), [p1, p2])