class_docstr: Tests for the quantum gradients of various gates
  with variance measurements
docstr: Test that the gradient works for a combination of CV expectation
  values and variances
docstr_tok: ["Test","that","the","gradient","works","for","a","combination","of","CV","expectation","values","and","variances"]
code: def test_expval_and_variance(self):
      """Test that the gradient works for a combination of CV expectation
      values and variances"""
      dev = qml.device("default.gaussian", wires=3)
  
      a, b = [0.54, -0.423]
  
      with qml.queuing.AnnotatedQueue() as q:
          qml.Displacement(0.5, 0, wires=0)
          qml.Squeezing(a, 0, wires=0)
          qml.Squeezing(b, 0, wires=1)
          qml.Beamsplitter(0.6, -0.3, wires=[0, 1])
          qml.Squeezing(-0.3, 0, wires=2)
          qml.Beamsplitter(1.4, 0.5, wires=[1, 2])
          qml.var(qml.QuadX(0))
          qml.expval(qml.QuadX(1))
          qml.var(qml.QuadX(2))
  
      tape = qml.tape.QuantumScript.from_queue(q)
      tape.trainable_params = {2, 4}
  
      with pytest.raises(
          ValueError,
          match="Computing the gradient of CV circuits that return more",
      ):
          param_shift_cv(tape, dev)
  
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 3 for calling the TestVarianceQuantumGradients obj's underlying member method code with example usage: obj.test_expval_and_variance() without return types