def test_add_steps(self) -> None: """Test add steps.""" graph = Graph() graph.add_steps(self.steps) self.assertEqual(self.steps, list(graph.steps.values())) self.assertEqual([step.name for step in self.steps], list(graph.steps.keys())) self.assertEqual(self.graph_dict_expected, graph.to_dict())
def test_pop(self): """Test pop.""" graph = Graph() graph.add_steps(self.steps) stack2 = next(step for step in self.steps if step.name == "stack2") self.assertEqual(stack2, graph.pop(stack2)) self.assertEqual({"stack1": set()}, graph.to_dict())
def test_dumps(self): """Test dumps.""" graph = Graph() graph.add_steps(self.steps) self.assertEqual(json.dumps(self.graph_dict), graph.dumps())