Skip to content

Commit 2f35616

Browse files
committed
Remove NoPathBetweenNodes from get_all_paths
1 parent 4c3f19d commit 2f35616

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/power_grid_model_ds/_core/model/graphs/models/base.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,6 @@ def get_all_paths(self, ext_start_node_id: int, ext_end_node_id: int) -> list[li
245245
target=self.external_to_internal(ext_end_node_id),
246246
)
247247

248-
if internal_paths == []:
249-
raise NoPathBetweenNodes(f"No path between nodes {ext_start_node_id} and {ext_end_node_id}")
250-
251248
return [self._internals_to_externals(path) for path in internal_paths]
252249

253250
def get_components(self, substation_nodes: NDArray[np.int32]) -> list[list[int]]:

tests/unit/model/graphs/test_graph_model.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,9 @@ def test_all_paths_on_circular_network(self, graph_with_5_nodes: BaseGraphModel)
225225
assert [1, 5, 4, 3] in paths
226226

227227
def test_all_paths_no_path(self, graph_with_5_nodes: BaseGraphModel):
228-
with pytest.raises(NoPathBetweenNodes):
229-
graph_with_5_nodes.get_all_paths(1, 2)
228+
path = graph_with_5_nodes.get_all_paths(1, 2)
229+
230+
assert path == []
230231

231232

232233
class TestFindFundamentalCycles:

0 commit comments

Comments
 (0)