def create_or_update(self, label: str, data: dict, context: Transaction): self.create_node(label=label, name=data['name']) check_node = self.get_node(self.node()) exits = False if type(check_node) is Node: exits = True self.node(check_node) self.assign_attributes(data) if exits is False: context.create(self.node()) print(f"Created {label}") else: context.push(self.node()) print(f"Updated {label}")
def test_should_fail_on_tx_push_object(): tx = Transaction(FakeGraph()) with raises(TypeError): tx.push(object())