class_docstr: Test the private helpers for preprocessing.
class_docstr_tok: ["Test","the","private","helpers","for","preprocessing","."]
docstr: Assert _operator_decomposition_gen turns into a list with the operators decomposition
  when only a single layer of expansion is necessary.
docstr_tok: ["Assert","_operator_decomposition_gen","turns","into","a","list","with","the","operators","decomposition","when","only","a","single","layer","of","expansion","is","necessary","."]
code: def test_operator_decomposition_gen_decomposed_operators_single_nesting(
      self,
  ):
      """Assert _operator_decomposition_gen turns into a list with the operators decomposition
      when only a single layer of expansion is necessary."""
  
      def stopping_condition(op):
          return op.has_matrix
  
      op = NoMatOp("a")
      casted_to_list = list(
          _operator_decomposition_gen(
              op, stopping_condition, self.decomposer
          )
      )
      assert len(casted_to_list) == 2
      assert qml.equal(casted_to_list[0], qml.PauliX("a"))
      assert qml.equal(casted_to_list[1], qml.PauliY("a"))
  
imports: import pytest
  import pennylane
  from pennylane.operation import Operation
  from pennylane.tape import QuantumScript
  from pennylane import DeviceError
  from pennylane.devices.preprocess import no_sampling, validate_device_wires, validate_multiprocessing_workers, validate_adjoint_trainable_params, _operator_decomposition_gen, decompose, validate_observables, validate_measurements
label_desc: Use image node_id 3 for calling the TestPrivateHelpers obj's underlying member method code with example usage: obj.test_operator_decomposition_gen_decomposed_operators_single_nesting() and returns: op