def test_remove_missing_edge_raises_undirected(): # given g = UndirectedGraph() g.add_edge(1, 2) g.add_edge(2, 3) g.add_edge(3, 1) # when with pytest.raises(DoesNotExistError): g.remove_edge(2, 4)
def test_remove_edge_undirected(): # given g = UndirectedGraph() g.add_edge(1, 2) g.add_edge(2, 3) g.add_edge(3, 1) # when g.remove_edge(2, 1) # then assert (1, 2) not in g.edges assert (2, 1) not in g.edges assert len(g.edges) == 2 assert len(g.nodes) == 3