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"}
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"}
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"}
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"}
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"}
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"}
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"}