def merge_nodes_and_relationships(tx: Transaction, nodes: List[Node], relationships: List[Relationship]): for node in nodes: tx.merge(node) for rel in relationships: tx.merge(rel)
def test_should_fail_on_tx_merge_object(): tx = Transaction(FakeGraph()) with raises(TypeError): tx.merge(object())
def create_or_merge_relationship(self, relation: Relationship, context: Transaction): if self.graph().exists(relation) is True: context.merge(relation) else: context.create(relation)