refactor: separate initialization of nodes and edges in test_graph.py (#2828)

* refactor: move test_graph.py

* refactor: allow Graph to be initialized with no nodes and edges

The Graph class in `base.py` was refactored to separate the initialization of nodes and edges into a separate method called `add_nodes_and_edges()`. This improves code readability and maintainability by organizing the code logic more effectively.

* refactor: separate initialization of nodes and edges in get_graph()

The `get_graph()` function in `conftest.py` was refactored to separate the initialization of nodes and edges. This improves code readability and maintainability by organizing the code logic more effectively.

* refactor: separate initialization of nodes and edges in test_graph.py

* refactor: separate initialization of nodes and edges in base.py

The `add_node()` and `add_edge()` methods were added to the `Graph` class in `base.py` to separate the initialization of nodes and edges. This improves code readability and maintainability by organizing the code logic more effectively.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-07-22 16:48:29 -03:00 committed by GitHub
commit 77cc789e62
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 51 additions and 33 deletions

View file

@ -158,7 +158,9 @@ def get_graph(_type="basic"):
data_graph = flow_graph["data"]
nodes = data_graph["nodes"]
edges = data_graph["edges"]
return Graph(nodes, edges)
graph = Graph()
graph.add_nodes_and_edges(nodes, edges)
return graph
@pytest.fixture