예제 #1
0
def test_can_pull_path(graph):
    path = graph.cypher.execute_one("CREATE p=()-[:KNOWS]->()-[:KNOWS]->() RETURN p")
    assert path.rels[0].properties["since"] is None
    graph.cypher.run("START ab=rel({ab}) SET ab.since=1999", {"ab": path.rels[0]._id})
    assert path.rels[0].properties["since"] is None
    batch = PullBatch(graph)
    batch.append(path)
    batch.pull()
    assert path.rels[0].properties["since"] == 1999
예제 #2
0
def test_can_pull_node(graph):
    uri = graph.cypher.execute_one("CREATE (a {name:'Alice'}) RETURN a").uri
    alice = Node()
    alice.bind(uri)
    assert alice.properties["name"] is None
    batch = PullBatch(graph)
    batch.append(alice)
    batch.pull()
    assert alice.properties["name"] == "Alice"
예제 #3
0
def test_can_pull_rel(graph):
    uri = graph.cypher.execute_one("CREATE ()-[ab:KNOWS {since:1999}]->() RETURN ab").uri
    ab = Relationship(None, "", None).rel
    ab.bind(uri)
    assert ab.type == ""
    assert ab.properties["since"] is None
    batch = PullBatch(graph)
    batch.append(ab)
    batch.pull()
    assert ab.type == "KNOWS"
    assert ab.properties["since"] == 1999
예제 #4
0
def test_can_pull_node_with_label(graph):
    if not graph.supports_node_labels:
        return
    uri = graph.cypher.execute_one("CREATE (a:Person {name:'Alice'}) RETURN a").uri
    alice = Node()
    alice.bind(uri)
    assert "Person" not in alice.labels
    assert alice.properties["name"] is None
    batch = PullBatch(graph)
    batch.append(alice)
    batch.pull()
    assert "Person" in alice.labels
    assert alice.properties["name"] == "Alice"