Skip to content

Commit 4cb80a4

Browse files
committed
fix merge issues
Signed-off-by: Thijs Baaijen <[email protected]>
1 parent 4cae2a4 commit 4cb80a4

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,6 @@ def nr_nodes(self):
3333
def nr_branches(self):
3434
return self._graph.num_edges()
3535

36-
@property
37-
def all_branches(self) -> list[frozenset[int]]:
38-
internal_branches = ((source, target) for source, target in self._graph.edge_list())
39-
external_branches = [
40-
frozenset([self.internal_to_external(source), self.internal_to_external(target)])
41-
for source, target in internal_branches
42-
]
43-
return external_branches
44-
4536
@property
4637
def external_ids(self) -> list[int]:
4738
return list(self._external_to_internal.keys())

tests/unit/model/graphs/test_graph_model.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,13 +353,17 @@ def test_tmp_remove_nodes(graph_with_2_routes) -> None:
353353

354354
assert graph.nr_nodes == 5
355355
assert graph.nr_branches == 6
356-
counter_before: Counter[frozenset] = Counter(graph.all_branches)
356+
357+
before_sets = [frozenset(branch) for branch in graph.all_branches]
358+
counter_before = Counter(before_sets)
357359

358360
with graph.tmp_remove_nodes([1, 2]):
359361
assert graph.nr_nodes == 3
360-
assert graph.all_branches == [{4, 5}]
362+
assert list(graph.all_branches) == [(5, 4)]
361363

362364
assert graph.nr_nodes == 5
363365
assert graph.nr_branches == 6
364-
counter_after: Counter[frozenset] = Counter(graph.all_branches)
366+
367+
after_sets = [frozenset(branch) for branch in graph.all_branches]
368+
counter_after = Counter(after_sets)
365369
assert counter_before == counter_after

0 commit comments

Comments
 (0)