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 <n> of a displaced thermal state
docstr_tok: ["test","correct","variance","for","<","n",">","of","a","displaced","thermal","state"]
code: def test_variance_displaced_thermal_mean_photon(self, tol):
      """test correct variance for <n> of a displaced thermal state"""
      dev = qml.device("default.gaussian", wires=1, hbar=hbar)
  
      nbar = 0.5431
      alpha = 0.324 - 0.59j
      dev.apply("ThermalState", wires=Wires([0]), par=[nbar])
      dev.apply("Displacement", wires=Wires([0]), par=[alpha, 0])
      var = dev.var("NumberOperator", Wires([0]), [])
      assert var == pytest.approx(
          nbar**2 + nbar + np.abs(alpha) ** 2 * (1 + 2 * nbar),
          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 9 for calling the TestDefaultGaussianDevice obj's underlying member method code with example usage: obj.test_variance_displaced_thermal_mean_photon(tol) without return types