コード例 #1
0
ファイル: writebatch_test.py プロジェクト: EricEllett/py2neo
def test_can_add_labels_to_preexisting_node(graph):
    if not graph.supports_node_labels:
        return
    alice, = graph.create({"name": "Alice"})
    batch = WriteBatch(graph)
    batch.add_labels(alice, "human", "female")
    batch.run()
    assert alice.get_labels() == {"human", "female"}
コード例 #2
0
ファイル: writebatch_test.py プロジェクト: EricEllett/py2neo
def test_can_add_labels_to_node_in_same_batch(graph):
    if not graph.supports_node_labels:
        return
    batch = WriteBatch(graph)
    a = batch.create({"name": "Alice"})
    batch.add_labels(a, "human", "female")
    results = batch.submit()
    alice = results[batch.find(a)]
    assert alice.get_labels() == {"human", "female"}
コード例 #3
0
ファイル: writebatch_test.py プロジェクト: zrg1993/py2neo
def test_can_add_labels_to_node_in_same_batch(graph):
    if not graph.supports_node_labels:
        return
    batch = WriteBatch(graph)
    a = batch.create({"name": "Alice"})
    batch.add_labels(a, "human", "female")
    results = batch.submit()
    alice = results[batch.find(a)]
    assert alice.labels == {"human", "female"}
コード例 #4
0
ファイル: writebatch_test.py プロジェクト: zrg1993/py2neo
def test_can_add_labels_to_preexisting_node(graph):
    if not graph.supports_node_labels:
        return
    alice, = graph.create({"name": "Alice"})
    batch = WriteBatch(graph)
    batch.add_labels(alice, "human", "female")
    batch.run()
    alice.pull()
    assert alice.labels == {"human", "female"}
コード例 #5
0
ファイル: writebatch_test.py プロジェクト: EricEllett/py2neo
def test_can_set_labels_on_node_in_same_batch(graph):
    if not graph.supports_node_labels:
        return
    batch = WriteBatch(graph)
    batch.create({"name": "Alice"})
    batch.add_labels(0, "human", "female")
    batch.set_labels(0, "mystery", "badger")
    results = batch.submit()
    alice = results[0]
    assert alice.get_labels() == {"mystery", "badger"}
コード例 #6
0
ファイル: writebatch_test.py プロジェクト: zrg1993/py2neo
def test_can_set_labels_on_node_in_same_batch(graph):
    if not graph.supports_node_labels:
        return
    batch = WriteBatch(graph)
    batch.create({"name": "Alice"})
    batch.add_labels(0, "human", "female")
    batch.set_labels(0, "mystery", "badger")
    results = batch.submit()
    alice = results[0]
    assert alice.labels == {"mystery", "badger"}
コード例 #7
0
ファイル: writebatch_test.py プロジェクト: JohannesOos/py2neo
def test_can_add_and_remove_labels_on_node_in_same_batch(graph):
    if not graph.supports_node_labels:
        return
    batch = WriteBatch(graph)
    alice = batch.create({"name": "Alice"})
    batch.add_labels(alice, "human", "female")
    batch.remove_label(alice, "female")
    results = batch.submit()
    alice = results[batch.find(alice)]
    assert alice.labels == {"human"}