code: def test_append_gate(circuit):
      """Test that append_gate properly adds a gate to a circuit."""
  
      param = np.array([0.0])
      gate = qml.DoubleExcitation(np.array(0.0), wires=[0, 1, 2, 3])
  
      final_circuit = qml.optimize.adaptive.append_gate(
          circuit.func, param, [gate]
      )
      qnode = qml.QNode(final_circuit, dev)
      _ = qnode()
      assert qml.equal(qnode.tape.operations[-1], gate)
  
      final_circuit, fn = qml.optimize.adaptive.append_gate(
          qnode.tape, param, [gate]
      )
  
      assert isinstance(final_circuit, list)
      assert isinstance(fn(final_circuit), qml.tape.QuantumScript)
  
file_path: pennylane/tests/optimize/test_adaptive.py
imports: import copy
  import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 7 for calling a global function with example usage: test_append_gate(circuit) without return types