Guard against bad edges being added to topology

styling
LEdoian 1 year ago
parent b6711dd32e
commit d17c8c4585

@ -78,6 +78,7 @@ class TopologyV3:
def add_edge(self, edge): def add_edge(self, edge):
if self.frozen: raise ValueError('Cannot add edge to frozen topology.') if self.frozen: raise ValueError('Cannot add edge to frozen topology.')
if edge.count <= 0: raise ValueError('Must not add non-existent edges')
# We need to merge relevant edges. Thus, this is more like adding a # We need to merge relevant edges. Thus, this is more like adding a
# multi-edge, which falls to no-op when the specific edge is already # multi-edge, which falls to no-op when the specific edge is already
# present. In other words, this means that we _may_ have multiple Edge # present. In other words, this means that we _may_ have multiple Edge

Loading…
Cancel
Save