class_docstr: Test the default gaussian device. The test ensures that the device is properly
  applying gaussian operations and calculating the correct observables.
class_docstr_tok: ["Test","the","default","gaussian","device",".","The","test","ensures","that","the","device","is","properly","applying","gaussian","operations","and","calculating","the","correct","observables","."]
docstr: test correct variance for Homodyne P measurement
docstr_tok: ["test","correct","variance","for","Homodyne","P","measurement"]
code: def test_variance_coherent_homodyne(self, tol):
      """test correct variance for Homodyne P measurement"""
      dev = qml.device("default.gaussian", wires=1, hbar=hbar)
  
      alpha = 0.324 - 0.59j
      dev.apply("CoherentState", wires=Wires([0]), par=[alpha])
      var = dev.var("QuadP", Wires([0]), [])
      assert var == pytest.approx(hbar / 2, abs=tol)
  
      # test correct mean and variance for Homodyne measurement
      var = dev.var("QuadOperator", Wires([0]), [np.pi / 2])
      assert var == pytest.approx(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 10 for calling the TestDefaultGaussianDevice obj's underlying member method code with example usage: obj.test_variance_coherent_homodyne(tol) without return types