code: def test_largest_gradient(circuit):
      """Test that step function selects the gate with the largest gradient."""
  
      opt = qml.AdaptiveOptimizer()
      circuit = opt.step(circuit, pool_exc)
      circuit()
      selected_gate = circuit.tape.operations[-1]
  
      #  the reference gate is obtained manually
      assert selected_gate.name == "DoubleExcitation"
      assert circuit.tape.operations[-1].wires == qml.wires.Wires(
          [0, 1, 4, 5]
      )
  
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 6 for calling a global function with example usage: test_largest_gradient(circuit) without return types