class_docstr: Test the state_vector() method of QutritBasisState operation.
class_docstr_tok: ["Test","the","state_vector","(",")","method","of","QutritBasisState","operation","."]
docstr: Test QutritBasisState initialization on a subset of device wires.
docstr_tok: ["Test","QutritBasisState","initialization","on","a","subset","of","device","wires","."]
code: def test_QutritBasisState_state_vector_computed(
      self, state, device_wires, op_wires
  ):
      """Test QutritBasisState initialization on a subset of device wires."""
      basis_op = qml.QutritBasisState(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)
  
file_path: pennylane/tests/ops/qutrit/test_qutrit_state_prep.py
imports: import pytest
  import pennylane
  from pennylane import numpy
  from pennylane.wires import WireError
label_desc: Use image node_id 2 for calling the TestStateVector obj's underlying member method code with example usage: obj.test_QutritBasisState_state_vector_computed(state, device_wires, op_wires) without return types