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: Tests that StatePrep state_vector returns kets with broadcasting as expected.
docstr_tok: ["Tests","that","StatePrep","state_vector","returns","kets","with","broadcasting","as","expected","."]
code: def test_StatePrep_state_vector_broadcasted(
      self, num_wires, wire_order, one_positions
  ):
      """Tests that StatePrep state_vector returns kets with broadcasting as expected."""
      qsv_op = qml.StatePrep(
          [[0, 0, 1, 0], [0, 1, 0, 0]], wires=[1, 2]
      )  # |10>, |01>
      ket = qsv_op.state_vector(wire_order=wire_order)
      assert ket[one_positions[0]] == 1 == ket[one_positions[1]]
      ket[one_positions[0]] = ket[one_positions[1]] = 0
      # everything else should be zero, as we assert below
      assert np.allclose(np.zeros((2,) * (num_wires + 1)), ket)
  
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_StatePrep_state_vector_broadcasted(num_wires, wire_order, one_positions) without return types