class_docstr: Test the state_vector() method of various CosineWindow operations.
class_docstr_tok: ["Test","the","state_vector","(",")","method","of","various","CosineWindow","operations","."]
docstr: Tests that the state vector is correct for a single wire.
docstr_tok: ["Tests","that","the","state","vector","is","correct","for","a","single","wire","."]
code: def test_CosineWindow_state_vector(self):
      """Tests that the state vector is correct for a single wire."""
      op = qml.CosineWindow(wires=[0])
      res = op.state_vector()
      expected = np.array([0.0, 1.0])
      assert np.allclose(res, expected)
  
      op = qml.CosineWindow(wires=[0, 1])
      res = np.reshape(op.state_vector() ** 2, (-1,))
      expected = np.array([0.0, 0.25, 0.5, 0.25])
      assert np.allclose(res, expected)
  
file_path: pennylane/tests/templates/test_state_preparations/test_cosine_window.py
imports: import pytest
  import numpy
  import pennylane
  from pennylane.wires import WireError
label_desc: Use image node_id 1 for calling the TestStateVector obj's underlying member method code with example usage: obj.test_CosineWindow_state_vector() without return types