예제 #1
0
def test_count(graph):
    assert graph.find(V(1).knows).count() == 3
    assert graph.find(V(1).likes).count() == 2
예제 #2
0
def test_find(graph):
    assert list(graph.find(V(1).knows)) == [2, 3, 4]
    assert list(graph.find(V().knows(1))) == [2, 3]
예제 #3
0
def test_nested_traverse(graph):
    query = graph.find(V(1).likes)\
                 .traverse(V().knows)\
                 .traverse(V().knows)
    assert query.to(list) == [2, 3, 4]
예제 #4
0
def test_traverse(graph):
    assert list(graph.find(V(1).knows).traverse(V().knows)) == [1, 1]
    assert list(graph.find(V(1).knows).traverse(V().knows(1))) == [2, 3]
예제 #5
0
def test_difference(graph):
    assert list(graph.find(V(1).knows).difference(V().knows(1))) == [4]
예제 #6
0
def test_intersection(graph):
    assert list(graph.find(V(1).knows).intersection(V().knows(1))) == [2, 3]