class_docstr: Tests for the quantum gradients of various gates
  with expectation value output
docstr: Test that the gradient of a circuit with two squeeze
  gates is correct.
docstr_tok: ["Test","that","the","gradient","of","a","circuit","with","two","squeeze","gates","is","correct","."]
code: def test_multiple_squeezing_gradient(self, mocker, tol):
      """Test that the gradient of a circuit with two squeeze
      gates is correct."""
      dev = qml.device("default.gaussian", wires=2, hbar=hbar)
  
      r0, phi0, r1, phi1 = [0.4, -0.3, -0.7, 0.2]
  
      with qml.queuing.AnnotatedQueue() as q:
          qml.Squeezing(r0, phi0, wires=[0])
          qml.Squeezing(r1, phi1, wires=[0])
          qml.expval(qml.NumberOperator(0))  # second order
  
      tape = qml.tape.QuantumScript.from_queue(q)
      spy2 = mocker.spy(
          qml.gradients.parameter_shift_cv, "second_order_param_shift"
      )
      tapes, fn = param_shift_cv(tape, dev, force_order2=True)
      grad_A2 = fn(dev.batch_execute(tapes))
      spy2.assert_called()
  
      # check against the known analytic formula
      expected = np.zeros([4])
      expected[0] = np.cosh(2 * r1) * np.sinh(2 * r0) + np.cos(
          phi0 - phi1
      ) * np.cosh(2 * r0) * np.sinh(2 * r1)
      expected[1] = (
          -0.5 * np.sin(phi0 - phi1) * np.sinh(2 * r0) * np.sinh(2 * r1)
      )
      expected[2] = np.cos(phi0 - phi1) * np.cosh(2 * r1) * np.sinh(
          2 * r0
      ) + np.cosh(2 * r0) * np.sinh(2 * r1)
      expected[3] = (
          0.5 * np.sin(phi0 - phi1) * np.sinh(2 * r0) * np.sinh(2 * r1)
      )
  
      assert np.allclose(grad_A2, expected, atol=tol, rtol=0)
  
imports: import unittest.mock
  import pytest
  import pennylane
  from pennylane import numpy
  from pennylane.gradients import param_shift_cv
  from pennylane.gradients.gradient_transform import choose_trainable_params
  from pennylane.gradients.parameter_shift_cv import _grad_method_cv, _find_gradient_methods_cv, _transform_observable
label_desc: Use image node_id 6 for calling the TestExpectationQuantumGradients obj's underlying member method code with example usage: obj.test_multiple_squeezing_gradient(mocker, tol) without return types