class_docstr: State tests.
class_docstr_tok: ["State","tests","."]
docstr: Test the squeezed state is correct.
docstr_tok: ["Test","the","squeezed","state","is","correct","."]
code: def test_squeezed_state(self, tol):
      """Test the squeezed state is correct."""
      r = 0.432
      phi = 0.123
      cov, means = squeezed_state(r, phi, hbar=hbar)
  
      # test vector of means is zero
      assert means == pytest.approx(np.zeros([2]), abs=tol)
  
      R = rotation(phi / 2)
      expected = (
          R
          @ np.array([[np.exp(-2 * r), 0], [0, np.exp(2 * r)]])
          * hbar
          / 2
          @ R.T
      )
      # test covariance matrix is correct
      assert cov == pytest.approx(expected, abs=tol)
  
imports: import numpy
  import numpy.random
  import pytest
  from scipy.linalg import block_diag
  from scipy.special import factorial
  import pennylane
  from pennylane import DeviceError
  from pennylane.devices.default_gaussian import fock_prob, rotation, squeezing, quadratic_phase, beamsplitter, two_mode_squeezing, controlled_addition, controlled_phase, vacuum_state, coherent_state, squeezed_state, displaced_squeezed_state, thermal_state
  from pennylane.wires import Wires
label_desc: Use image node_id 3 for calling the TestStates obj's underlying member method code with example usage: obj.test_squeezed_state(tol) without return types