class_docstr: Tests for the custom_decomps argument for devices
class_docstr_tok: ["Tests","for","the","custom_decomps","argument","for","devices"]
docstr: Test that decomposing a template into another template and some
  gates yields the correct results.
docstr_tok: ["Test","that","decomposing","a","template","into","another","template","and","some","gates","yields","the","correct","results","."]
code: def test_custom_decomp_template_to_template(self, device_name):
      """Test that decomposing a template into another template and some
      gates yields the correct results."""
  
      # BasicEntanglerLayers custom decomposition involves AngleEmbedding
      custom_decomps = {
          "BasicEntanglerLayers": custom_basic_entangler_layers,
          "RX": custom_rx,
      }
      decomp_dev = qml.device(
          device_name, wires=2, custom_decomps=custom_decomps
      )
  
      @qml.qnode(decomp_dev, expansion_strategy="device")
      def circuit():
          qml.BasicEntanglerLayers([[0.1, 0.2]], wires=[0, 1])
          return qml.expval(qml.PauliZ(0))
  
      _ = circuit()
      decomp_ops = circuit.tape.operations
  
      assert len(decomp_ops) == 5
  
      assert decomp_ops[0].name == "RY"
      assert decomp_ops[0].parameters[0] == 0.1
      assert decomp_ops[0].wires == Wires(0)
  
      assert decomp_ops[1].name == "Hadamard"
      assert decomp_ops[1].wires == Wires(0)
  
      assert decomp_ops[2].name == "RY"
      assert np.isclose(decomp_ops[2].parameters[0], 0.2)
      assert decomp_ops[2].wires == Wires(1)
  
      assert decomp_ops[3].name == "Hadamard"
      assert decomp_ops[3].wires == Wires(1)
  
      assert decomp_ops[4].name == "CNOT"
      assert decomp_ops[4].wires == Wires([0, 1])
  
imports: import pytest
  import numpy
  import pennylane
  from pennylane.wires import Wires
label_desc: Use image node_id 9 for calling the TestCreateCustomDecompExpandFn obj's underlying member method code with example usage: obj.test_custom_decomp_template_to_template(device_name) and returns: qml