Exemple #1
0
def addNoEdge_test():
    G = Graph()
    G.add_nodes_from(Friends)
    G.add_edges_from(Relationships)
    exp = G.edges()
    # remove an edge but give an empty list
    G.remove_edge([])
    obs = G.edges()
    assert_equal(exp, obs)
Exemple #2
0
def removePartEdge_test():
    G = Graph()
    G.add_nodes_from(Friends)
    G.add_edges_from(Relationships)
    exp = G.edges()
    # remove an edge but give a single part of the edge
    G.remove_edge(['Alex'])
    obs = G.edges()
    assert_equal(exp, obs)
Exemple #3
0
def emptyEdges_test():
    G = Graph()
    G.add_nodes_from(Friends)
    G.add_edges_from(Relationships)
    # test "edges" when given a string and not a list of strings
    obs = G.edges('Alex')
    exp = [['Alex', 'Julie'], ['Alex', 'Michael'], ['Alex', 'Ved']]
    assert_equal(exp, obs)
Exemple #4
0
def removeEdgeMorethan2_test():
    G = Graph()
    G.add_nodes_from(Friends)
    G.add_edges_from(Relationships)
    # remove an edge but give three entries
    G.remove_edge(['Alex', 'Julie', 'Michael'])
    exp = 21
    obs = len(G.edges())
    assert_equal(exp, obs)