예제 #1
0
def test_get_vertices_graph_with_one_vertex():
    """Test whether method DirectedGraph.get_vertices() works correctly."""
    g = DirectedGraph()
    v0 = g.add_vertex(vertex_props=None)

    list_vertices = g.get_vertices()
    assert len(list_vertices) == 1
    assert v0 in list_vertices
def test_get_vertices():
    g = DirectedGraph()
    v0 = g.add_vertex(vertex_props=None)
    v1 = g.add_vertex(vertex_props=None)

    list_vertices = g.get_vertices()
    assert len(list_vertices) == 2
    assert v0 in list_vertices
    assert v1 in list_vertices
예제 #3
0
def test_get_vertices_empty_graph():
    """Test whether method DirectedGraph.get_vertices() works correctly for empty graph."""
    g = DirectedGraph()

    list_vertices = g.get_vertices()
    assert not list_vertices