Пример #1
0
def test_graph_nodes_list():
    graph = Graph()
    a = graph.add_node("a")
    b = graph.add_node("b")
    actual = graph.get_nodes()
    expected = [a, b]
    assert actual == expected
Пример #2
0
def test_get_nodes():
    g = Graph()
    g.add_node('a')
    g.add_node('b')
    expected = ['a', 'b']
    actual = []
    [actual.append(item.value) for item in g.get_nodes()]
    assert actual == expected
Пример #3
0
def test_get_nodes():

    graph = Graph()

    graph.add_node("banana")

    graph.add_node("apple")

    expected = 2

    actual = len(graph.get_nodes())

    assert actual == expected
Пример #4
0
def test_graph_nodes_empty():
    graph = Graph()
    actual = graph.get_nodes()
    expected = None
    assert actual == expected
Пример #5
0
def test_get_all_nodes():
    graph = Graph()
    node = graph.add_node('node')
    node_two = graph.add_node('node_two')
    assert len(graph.get_nodes()) == 2