class_docstr: Tests for the quantum_monte_carlo function
class_docstr_tok: ["Tests","for","the","quantum_monte_carlo","function"]
docstr: Test if quantum_monte_carlo generates the correct circuit by comparing it to the
  QuantumMonteCarlo template on the practical example specified in the usage details. Custom
  wire labels are also used.
docstr_tok: ["Test","if","quantum_monte_carlo","generates","the","correct","circuit","by","comparing","it","to","the","QuantumMonteCarlo","template","on","the","practical","example","specified","in","the","usage","details",".","Custom","wire","labels","are","also","used","."]
code: def test_integration(self):
      """Test if quantum_monte_carlo generates the correct circuit by comparing it to the
      QuantumMonteCarlo template on the practical example specified in the usage details. Custom
      wire labels are also used."""
  
      m = 5  # number of wires in A
      M = 2**m
  
      xmax = np.pi  # bound to region [-pi, pi]
      xs = np.linspace(-xmax, xmax, M)
  
      probs = np.array([norm().pdf(x) for x in xs])
      probs /= np.sum(probs)
  
      func = lambda i: np.sin(xs[i]) ** 2
      r_rotations = np.array(
          [2 * np.arcsin(np.sqrt(func(i))) for i in range(M)]
      )
  
      A_wires = [0, "a", -1.1, -10, "bbb"]
      target_wire = "Ancilla"
      wires = A_wires + [target_wire]
      estimation_wires = ["bob", -3, 42, "penny", "lane"]
  
      def fn():
          qml.templates.MottonenStatePreparation(
              np.sqrt(probs), wires=A_wires
          )
          r_unitary(
              qml.RY,
              r_rotations,
              control_wires=A_wires[::-1],
              target_wire=target_wire,
          )
  
      qmc_circuit = qml.quantum_monte_carlo(
          fn,
          wires=wires,
          target_wire=target_wire,
          estimation_wires=estimation_wires,
      )
  
      dev = qml.device("default.qubit", wires=wires + estimation_wires)
  
      @qml.qnode(dev)
      def circuit():
          qmc_circuit()
          return qml.probs(estimation_wires)
  
      @qml.qnode(dev)
      def circuit_expected():
          qml.templates.QuantumMonteCarlo(
              probs,
              func,
              target_wires=wires,
              estimation_wires=estimation_wires,
          )
          return qml.probs(estimation_wires)
  
      res = circuit()
      res_expected = circuit_expected()
  
      assert np.allclose(res, res_expected)
  
file_path: pennylane/tests/transforms/test_qmc_transform.py
imports: import itertools
  import numpy
  import pytest
  from scipy.stats import unitary_group, norm
  import pennylane
  from pennylane.transforms.qmc import _apply_controlled_z, _apply_controlled_v, apply_controlled_Q, quantum_monte_carlo
  from pennylane.templates.subroutines.qmc import _make_V, _make_Z, make_Q
  from pennylane.wires import Wires
label_desc: Use image node_id 3 for calling the TestQuantumMonteCarlo obj's underlying member method code with example usage: obj.test_integration() and returns: qml, qml