class_docstr: Tests that sampling is correctly implemented.
class_docstr_tok: ["Tests","that","sampling","is","correctly","implemented","."]
docstr: Tests that the np.random.normal is called with the correct parameters that reflect
  the underlying distribution for a coherent state when using QuadOperator.
docstr_tok: ["Tests","that","the","np.random.normal","is","called","with","the","correct","parameters","that","reflect","the","underlying","distribution","for","a","coherent","state","when","using","QuadOperator","."]
code: def test_sampling_parameters_coherent_quad_operator(
      self, tol, gaussian_device_1_wire, alpha, monkeypatch
  ):
      """Tests that the np.random.normal is called with the correct parameters that reflect
      the underlying distribution for a coherent state when using QuadOperator.
      """
  
      mean = alpha.imag * np.sqrt(2 * gaussian_device_1_wire.hbar)
      std = gaussian_device_1_wire.hbar / 2
      gaussian_device_1_wire.apply(
          "CoherentState", wires=Wires([0]), par=[alpha]
      )
  
      with monkeypatch.context() as m:
          m.setattr(numpy.random, "normal", input_logger)
          gaussian_device_1_wire.sample(
              "QuadOperator", Wires([0]), [np.pi / 2]
          )
          assert np.isclose(
              input_logger.args[0], mean, atol=tol, rtol=0
          )
          assert np.isclose(input_logger.args[1], std, atol=tol, rtol=0)
          assert input_logger.args[2] == gaussian_device_1_wire.shots
  
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 TestSample obj's underlying member method code with example usage: obj.test_sampling_parameters_coherent_quad_operator(tol, gaussian_device_1_wire, alpha, monkeypatch) without return types