class_docstr: Unit tests for the to_openqasm() method
class_docstr_tok: ["Unit","tests","for","the","to_openqasm","(",")","method"]
docstr: Test that the basis state preparation decomposition
  is correctly applied.
docstr_tok: ["Test","that","the","basis","state","preparation","decomposition","is","correctly","applied","."]
code: def test_basis_state_initialization_decomposition(self):
      """Test that the basis state preparation decomposition
      is correctly applied."""
      basis_state = np.array([1, 0, 1, 1])
  
      with qml.queuing.AnnotatedQueue() as q1:
          qml.BasisState(basis_state, wires=[0, 1, 2, 3])
  
      circuit1 = qml.tape.QuantumScript.from_queue(q1)
      qasm1 = circuit1.to_openqasm()
  
      with qml.queuing.AnnotatedQueue() as q2:
          qml.BasisState.compute_decomposition(
              basis_state, wires=[0, 1, 2, 3]
          )
  
      circuit2 = qml.tape.QuantumScript.from_queue(q2)
      qasm2 = circuit2.to_openqasm(wires=[0, 1, 2, 3])
  
      expected = dedent(
          """\
              OPENQASM 2.0;
              include "qelib1.inc";
              qreg q[4];
              creg c[4];
              x q[0];
              x q[2];
              x q[3];
              measure q[0] -> c[0];
              measure q[1] -> c[1];
              measure q[2] -> c[2];
              measure q[3] -> c[3];
              """
      )
  
      assert qasm1 == expected
      assert qasm1 == qasm2
  
imports: from textwrap import dedent
  import numpy
  import pytest
  import pennylane
  from pennylane.wires import Wires
label_desc: Use image node_id 7 for calling the TestToQasmUnitTests obj's underlying member method code with example usage: obj.test_basis_state_initialization_decomposition() without return types