class_docstr: Test inputs and pre-processing.
class_docstr_tok: ["Test","inputs","and","pre-processing","."]
docstr: Verifies that exception is raised if the
  number of dimensions of features is incorrect.
docstr_tok: ["Verifies","that","exception","is","raised","if","the","number","of","dimensions","of","features","is","incorrect","."]
code: def test_exception_wrong_dim(self):
      """Verifies that exception is raised if the
      number of dimensions of features is incorrect."""
      dev = qml.device("default.qubit", wires=2)
  
      @qml.qnode(dev)
      def circuit(basis_state):
          qml.BasisStatePreparation(basis_state, wires=range(2))
          return qml.expval(qml.PauliZ(0))
  
      with pytest.raises(
          ValueError, match="Basis states must be one-dimensional"
      ):
          basis_state = np.array([[[0, 1]]])
          circuit(basis_state)
  
      with pytest.raises(
          ValueError, match="Basis states must be of length"
      ):
          basis_state = np.array([0, 1, 0])
          circuit(basis_state)
  
      with pytest.raises(
          ValueError, match="Basis states must only consist of"
      ):
          basis_state = np.array([0, 2])
          circuit(basis_state)
  
file_path: pennylane/tests/templates/test_state_preparations/test_basis_state_prep.py
imports: import pytest
  import numpy
  import pennylane
label_desc: Use image node_id 3 for calling the TestInputs obj's underlying member method code with example usage: obj.test_exception_wrong_dim() and returns: qml