class_docstr: State tests.
class_docstr_tok: ["State","tests","."]
docstr: Test the coherent state is correct.
docstr_tok: ["Test","the","coherent","state","is","correct","."]
code: def test_coherent_state(self, tol):
      """Test the coherent state is correct."""
      a = 0.432 - 0.123j
      cov, means = coherent_state(a, hbar=hbar)
      assert means == pytest.approx(
          np.array([a.real, a.imag]) * np.sqrt(2 * hbar), abs=tol
      )
      assert cov == pytest.approx(np.identity(2) * hbar / 2, 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 2 for calling the TestStates obj's underlying member method code with example usage: obj.test_coherent_state(tol) without return types