class_docstr: Tests for the custom_decomps argument for devices
class_docstr_tok: ["Tests","for","the","custom_decomps","argument","for","devices"]
docstr: Test that creating a custom decomposition includes overwriting the
  correct method under the hood and produces expected results.
docstr_tok: ["Test","that","creating","a","custom","decomposition","includes","overwriting","the","correct","method","under","the","hood","and","produces","expected","results","."]
code: def test_custom_decomp_used_twice(self):
      """Test that creating a custom decomposition includes overwriting the
      correct method under the hood and produces expected results."""
      res = []
      for _ in range(2):
          custom_decomps = {
              "MultiRZ": qml.MultiRZ.compute_decomposition
          }
          dev = qml.device(
              "lightning.qubit", wires=2, custom_decomps=custom_decomps
          )
  
          @qml.qnode(dev, diff_method="adjoint")
          def cost(theta):
              qml.Hadamard(wires=0)
              qml.Hadamard(wires=1)
              qml.MultiRZ(theta, wires=[1, 0])
              return qml.expval(qml.PauliX(1))
  
          x = np.array(0.5)
          res.append(cost(x))
  
      assert res[0] == res[1]
  
imports: import pytest
  import numpy
  import pennylane
  from pennylane.wires import Wires
label_desc: Use image node_id 15 for calling the TestCreateCustomDecompExpandFn obj's underlying member method code with example usage: obj.test_custom_decomp_used_twice() and returns: qml