def test_sg_del_edge(): """Ensure supplied edge is deleted from appropriate node.""" from simple_graph import SimpleGraph test_sg = SimpleGraph() test_sg.add_edge("B", "c") test_sg.del_edge("B", "c") assert ("B", "c") not in test_sg.edges()
def test_sg_del_node(): """Ensure correct node is deleted, and all its edges are removed.""" from simple_graph import SimpleGraph test_sg = SimpleGraph() test_sg.add_edge("a", "c") test_sg.add_edge("b", "c") test_sg.add_edge("c", "b") test_sg.del_node("c") assert "c" not in test_sg.edges()
def test_edges(): from simple_graph import SimpleGraph new_graph = SimpleGraph() new_graph.add_edge('A', 'B', 25) assert new_graph.edges() == [('A', 'B', 25)]
def test_edge_display_empty(): from simple_graph import SimpleGraph instance = SimpleGraph() assert instance.edges() == []
def test_edge_display(): from simple_graph import SimpleGraph instance = SimpleGraph() instance.add_edge('waffles', 'waffles2') assert instance.edges()[0] == 'waffles-waffles2'
def test_sg_edges(): """Ensure edges returns correct list of edges in graph.""" from simple_graph import SimpleGraph test_sg = SimpleGraph() test_sg.add_edge("node_a", "node_b") assert test_sg.edges() == [("node_a", "node_b")]