class_docstr: Test that the QASM serialization works correctly
  when circuits are created via QNodes.
class_docstr_tok: ["Test","that","the","QASM","serialization","works","correctly","when","circuits","are","created","via","QNodes","."]
docstr: Test that the Mottonen state prepration decomposition
  is correctly applied.
docstr_tok: ["Test","that","the","Mottonen","state","prepration","decomposition","is","correctly","applied","."]
code: def test_state_initialization_decomposition(self):
      """Test that the Mottonen state prepration decomposition
      is correctly applied."""
      dev = qml.device("default.qubit", wires=2)
  
      @qml.qnode(dev)
      def qnode(state=None):
          qml.StatePrep(state, wires=[0, 1])
          return qml.expval(qml.PauliZ(0))
  
      # construct the qnode circuit
      qnode(state=np.array([1, -1, -1, 1]) / np.sqrt(4))
      res = qnode.qtape.to_openqasm(precision=11)
  
      expected = dedent(
          """\
              OPENQASM 2.0;
              include "qelib1.inc";
              qreg q[2];
              creg c[2];
              ry(1.5707963268) q[0];
              ry(1.5707963268) q[1];
              cx q[0],q[1];
              cx q[0],q[1];
              cx q[0],q[1];
              rz(3.1415926536) q[1];
              cx q[0],q[1];
              measure q[0] -> c[0];
              measure q[1] -> c[1];
              """
      )
  
      assert res == expected
  
imports: from textwrap import dedent
  import numpy
  import pytest
  import pennylane
  from pennylane.wires import Wires
label_desc: Use image node_id 6 for calling the TestQNodeQasmIntegrationTests obj's underlying member method code with example usage: obj.test_state_initialization_decomposition() and returns: qml