class_docstr: Tests that the template defines the correct decomposition.
class_docstr_tok: ["Tests","that","the","template","defines","the","correct","decomposition","."]
docstr: Tests that the cascade of RZ gates is skipped for real-valued states.
docstr_tok: ["Tests","that","the","cascade","of","RZ","gates","is","skipped","for","real-valued","states","."]
code: def test_RZ_skipped(self, mocker, state_vector, n_wires):
      """Tests that the cascade of RZ gates is skipped for real-valued states."""
  
      n_CNOT = 2**n_wires - 2
  
      dev = qml.device("default.qubit", wires=n_wires)
  
      @qml.qnode(dev, interface="autograd")
      def circuit(state_vector):
          qml.MottonenStatePreparation(
              state_vector, wires=range(n_wires)
          )
          return qml.expval(qml.PauliX(wires=0))
  
      # when the RZ cascade is skipped, CNOT gates should only be those required for RY cascade
      spy = mocker.spy(circuit.device, "execute")
      circuit(state_vector)
      tape = spy.call_args[0][0][0]
  
      assert tape.specs["resources"].gate_types["CNOT"] == n_CNOT
  
imports: import pytest
  import numpy
  import pennylane
  from pennylane import numpy
  from pennylane.templates.state_preparations.mottonen import gray_code, _get_alpha_y
label_desc: Use image node_id 3 for calling the TestDecomposition obj's underlying member method code with example usage: obj.test_RZ_skipped(mocker, state_vector, n_wires) and returns: qml