def test_has_node(): """edge added, new node added""" g = SimpleGraph() g.add_node('a') g.add_node('b') g.add_node('c') g.add_edge('a', 'c') g.add_edge('a', 'b') assert g.has_node('b')
def test_add_edge(): """edge added, new node added""" g = SimpleGraph() g.add_node('a') g.add_node('b') g.add_node('c') g.add_edge('a', 'c') g.add_edge('a', 'b') g.add_edge('q', 'a') assert g.has_node('q') assert g.neighbors('q') == {'a': 0}
def test_del_nodes(): """nodes are deleted""" g = SimpleGraph() g.add_node('a') g.add_node('b') g.add_node('c') g.add_edge('a', 'c') g.add_edge('a', 'b') g.del_node('a') assert 'a' not in g.nodes() assert g.has_node('a') is False