예제 #1
0
def test_del_error():
    """error raised when non-existant value 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')
    with pytest.raises(KeyError):
        g.del_node('p')
예제 #2
0
def test_del_error():
    """error raised when non-existant value 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')
    with pytest.raises(KeyError):
        g.del_node('p')
예제 #3
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
예제 #4
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
예제 #5
0
def test_weighted_edges_with_node_delete():
    g = SimpleGraph()
    g.add_edge('a', 'b', 5)
    g.add_edge('a', 'c', 2)
    g.del_node('c')
    assert g.dict_graph['a'] == {'b': 5}
예제 #6
0
def test_weighted_edges_with_node_delete():
    g = SimpleGraph()
    g.add_edge('a', 'b', 5)
    g.add_edge('a', 'c', 2)
    g.del_node('c')
    assert g.dict_graph['a'] == {'b': 5}