class_docstr: Unit tests for the hadamard_grad function
class_docstr_tok: ["Unit","tests","for","the","hadamard_grad","function"]
docstr: Tests correct output shape and evaluation for a tape
  with prob and expval outputs
code: def test_prob_expectation_values(self, tol):
      """Tests correct output shape and evaluation for a tape
      with prob and expval outputs"""
  
      dev = qml.device("default.qubit", wires=3)
      x = 0.543
      y = -0.654
  
      with qml.queuing.AnnotatedQueue() as q:
          qml.RX(x, wires=[0])
          qml.RY(y, wires=[1])
          qml.CNOT(wires=[0, 1])
          qml.expval(qml.PauliZ(0))
          qml.probs(wires=[0, 1])
  
      tape = qml.tape.QuantumScript.from_queue(q)
  
      res_hadamard, tapes = grad_fn(tape, dev)
  
      assert len(tapes) == 2
  
      assert isinstance(res_hadamard, tuple)
      assert len(res_hadamard) == 2
  
      assert isinstance(res_hadamard[0], tuple)
      assert len(res_hadamard[0]) == 2
  
      assert isinstance(res_hadamard[0][0], np.ndarray)
      assert res_hadamard[0][0].shape == ()
      assert isinstance(res_hadamard[0][1], np.ndarray)
      assert res_hadamard[0][1].shape == ()
  
      assert isinstance(res_hadamard[1], tuple)
      assert len(res_hadamard[1]) == 2
  
      assert isinstance(res_hadamard[1][0], np.ndarray)
      assert res_hadamard[1][0].shape == (4,)
      assert isinstance(res_hadamard[1][1], np.ndarray)
      assert res_hadamard[1][1].shape == (4,)
  
      expval_expected = [-2 * np.sin(x) / 2, 0]
      probs_expected = (
          np.array(
              [
                  [
                      -(np.cos(y / 2) ** 2 * np.sin(x)),
                      -(np.cos(x / 2) ** 2 * np.sin(y)),
                  ],
                  [
                      -(np.sin(x) * np.sin(y / 2) ** 2),
                      (np.cos(x / 2) ** 2 * np.sin(y)),
                  ],
                  [
                      (np.sin(x) * np.sin(y / 2) ** 2),
                      (np.sin(x / 2) ** 2 * np.sin(y)),
                  ],
                  [
                      (np.cos(y / 2) ** 2 * np.sin(x)),
                      -(np.sin(x / 2) ** 2 * np.sin(y)),
                  ],
              ]
          )
          / 2
      )
      # Expvals
      assert np.allclose(res_hadamard[0][0], expval_expected[0], tol)
      assert np.allclose(res_hadamard[0][1], expval_expected[1], tol)
  
      # Probs
      assert np.allclose(res_hadamard[1][0], probs_expected[:, 0], tol)
      assert np.allclose(res_hadamard[1][1], probs_expected[:, 1], tol)
  
imports: import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 15 for calling the TestHadamardGrad obj's underlying member method code with example usage: obj.test_prob_expectation_values(tol) without return types