From 4cb80a42c72587ad80c92582b328bdb21b3f9e2e Mon Sep 17 00:00:00 2001 From: Thijs Baaijen <13253091+Thijss@users.noreply.github.com> Date: Tue, 28 Jan 2025 10:36:01 +0100 Subject: [PATCH] fix merge issues Signed-off-by: Thijs Baaijen <13253091+Thijss@users.noreply.github.com> --- .../_core/model/graphs/models/rustworkx.py | 9 --------- tests/unit/model/graphs/test_graph_model.py | 10 +++++++--- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/power_grid_model_ds/_core/model/graphs/models/rustworkx.py b/src/power_grid_model_ds/_core/model/graphs/models/rustworkx.py index bfe0c89..397297d 100644 --- a/src/power_grid_model_ds/_core/model/graphs/models/rustworkx.py +++ b/src/power_grid_model_ds/_core/model/graphs/models/rustworkx.py @@ -33,15 +33,6 @@ def nr_nodes(self): def nr_branches(self): return self._graph.num_edges() - @property - def all_branches(self) -> list[frozenset[int]]: - internal_branches = ((source, target) for source, target in self._graph.edge_list()) - external_branches = [ - frozenset([self.internal_to_external(source), self.internal_to_external(target)]) - for source, target in internal_branches - ] - return external_branches - @property def external_ids(self) -> list[int]: return list(self._external_to_internal.keys()) diff --git a/tests/unit/model/graphs/test_graph_model.py b/tests/unit/model/graphs/test_graph_model.py index a05af7f..579f57f 100644 --- a/tests/unit/model/graphs/test_graph_model.py +++ b/tests/unit/model/graphs/test_graph_model.py @@ -353,13 +353,17 @@ def test_tmp_remove_nodes(graph_with_2_routes) -> None: assert graph.nr_nodes == 5 assert graph.nr_branches == 6 - counter_before: Counter[frozenset] = Counter(graph.all_branches) + + before_sets = [frozenset(branch) for branch in graph.all_branches] + counter_before = Counter(before_sets) with graph.tmp_remove_nodes([1, 2]): assert graph.nr_nodes == 3 - assert graph.all_branches == [{4, 5}] + assert list(graph.all_branches) == [(5, 4)] assert graph.nr_nodes == 5 assert graph.nr_branches == 6 - counter_after: Counter[frozenset] = Counter(graph.all_branches) + + after_sets = [frozenset(branch) for branch in graph.all_branches] + counter_after = Counter(after_sets) assert counter_before == counter_after