class_docstr: Test the state_vector() method of various state-prep operations.
class_docstr_tok: ["Test","the","state_vector","(",")","method","of","various","state-prep","operations","."]
docstr: Test BasisState initialization on a subset of device wires.
docstr_tok: ["Test","BasisState","initialization","on","a","subset","of","device","wires","."]
code: def test_BasisState_state_vector_computed(
      self, state, device_wires, op_wires
  ):
      """Test BasisState initialization on a subset of device wires."""
      basis_op = qml.BasisState(state, wires=op_wires)
      basis_state = basis_op.state_vector(
          wire_order=list(range(device_wires))
      )
  
      one_index = [0] * device_wires
      for op_wire, idx_value in zip(op_wires, state):
          if idx_value == 1:
              one_index[op_wire] = 1
      one_index = tuple(one_index)
  
      assert basis_state[one_index] == 1
      basis_state[one_index] = 0
      assert not np.any(basis_state)
  
imports: import pytest
  import pennylane
  from pennylane import numpy
  from pennylane.wires import WireError
label_desc: Use image node_id 16 for calling the TestStateVector obj's underlying member method code with example usage: obj.test_BasisState_state_vector_computed(state, device_wires, op_wires) without return types