Skip to content

Commit

Permalink
fix merge issues
Browse files Browse the repository at this point in the history
Signed-off-by: Thijs Baaijen <[email protected]>
  • Loading branch information
Thijss committed Jan 28, 2025
1 parent 4cae2a4 commit 4cb80a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
10 changes: 7 additions & 3 deletions tests/unit/model/graphs/test_graph_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 4cb80a4

Please sign in to comment.