class_docstr: Test preprocess produces output that can be executed by the device.
class_docstr_tok: ["Test","preprocess","produces","output","that","can","be","executed","by","the","device","."]
docstr: Test that a tape is expanded correctly if adjoint differentiation is requested
docstr_tok: ["Test","that","a","tape","is","expanded","correctly","if","adjoint","differentiation","is","requested"]
code: def test_preprocess_tape_for_adjoint(self):
      """Test that a tape is expanded correctly if adjoint differentiation is requested"""
      qs = qml.tape.QuantumScript(
          [qml.Rot(0.1, 0.2, 0.3, wires=0), qml.CNOT([0, 1])],
          [qml.expval(qml.PauliZ(1))],
      )
      execution_config = qml.devices.ExecutionConfig(
          gradient_method="adjoint"
      )
  
      program, _ = qml.device("default.qubit").preprocess(
          execution_config
      )
      expanded_tapes, _ = program([qs])
  
      assert len(expanded_tapes) == 1
      expanded_qs = expanded_tapes[0]
  
      expected_qs = qml.tape.QuantumScript(
          [
              qml.RZ(0.1, wires=0),
              qml.RY(0.2, wires=0),
              qml.RZ(0.3, wires=0),
              qml.CNOT([0, 1]),
          ],
          [qml.expval(qml.PauliZ(1))],
      )
  
      assert expanded_qs.operations == expected_qs.operations
      assert expanded_qs.measurements == expected_qs.measurements
      assert (
          expanded_qs.trainable_params == expected_qs.trainable_params
      )
  
imports: import pytest
  import numpy
  import pennylane
  from pennylane.devices import DefaultQubit, ExecutionConfig
  from pennylane.devices.default_qubit import stopping_condition
label_desc: Use image node_id 11 for calling the TestPreprocessingIntegration obj's underlying member method code with example usage: obj.test_preprocess_tape_for_adjoint() without return types