class_docstr: Tests for variance of tensor observables
class_docstr_tok: ["Tests","for","variance","of","tensor","observables"]
docstr: Test that a tensor product involving PauliZ and hadamard works correctly
docstr_tok: ["Test","that","a","tensor","product","involving","PauliZ","and","hadamard","works","correctly"]
code: def test_pauliz_tensor_hadamard(
      self, shots, theta, phi, varphi, tolerance
  ):
      """Test that a tensor product involving PauliZ and hadamard works correctly"""
      dev = qml.device("default.qubit", wires=3, shots=shots)
  
      @qml.qnode(dev)
      def circuit(a, b, c):
          ansatz(a, b, c)
          return var(qml.PauliZ(0) @ qml.Hadamard(1) @ qml.PauliY(2))
  
      res = circuit(theta, phi, varphi)
      expected = (
          3
          + np.cos(2 * phi) * np.cos(varphi) ** 2
          - np.cos(2 * theta) * np.sin(varphi) ** 2
          - 2 * np.cos(theta) * np.sin(phi) * np.sin(2 * varphi)
      ) / 4
  
      assert np.allclose(res, expected, **tolerance)
  
imports: import functools
  import pytest
  import numpy
  import pennylane
  from pennylane import expval, var, sample
label_desc: Use image node_id 3 for calling the TestTensorVar obj's underlying member method code with example usage: obj.test_pauliz_tensor_hadamard(shots, theta, phi, varphi, tolerance) and returns: var