Exemple #1
0
def test_has_node(node, n, result):
    """Test to check if a node exists in graph."""
    from weight_graph import Graph
    g = Graph()
    for idx in node:
        g.add_node(idx)
    assert g.has_node(n) == result
Exemple #2
0
def test_has_node_returns_true_if_node_serched_is_in_weight_graph(num):
    """Test that has node returns true if looking for node present in weight graph."""
    from weight_graph import Graph
    g = Graph()
    for x in range(num):
        g.add_node(x)
    for x in range(num):
        assert g.has_node(x)