class_docstr: Test that a device different to default.qubit gives the same result
docstr: Test that the tensor product of PauliZ expectation value is correct
docstr_tok: ["Test","that","the","tensor","product","of","PauliZ","expectation","value","is","correct"]
code: def test_pauliz_expectation_analytic(self, device, tol):
      """Test that the tensor product of PauliZ expectation value is correct"""
      n_wires = 2
      dev = device(n_wires)
      dev_def = qml.device("default.qubit", wires=n_wires)
  
      if dev.name == dev_def.name:
          pytest.skip("Device is default.qubit.")
  
      supports_tensor = (
          "supports_tensor_observables" in dev.capabilities()
          and dev.capabilities()["supports_tensor_observables"]
      )
  
      if not supports_tensor:
          pytest.skip("Device does not support tensor observables.")
  
      if dev.shots is not None:
          pytest.skip("Device is in non-analytical mode.")
  
      theta = 0.432
      phi = 0.123
  
      def circuit(theta, phi):
          qml.RX(theta, wires=[0])
          qml.RX(phi, wires=[1])
          qml.CNOT(wires=[0, 1])
          return qml.expval(qml.PauliZ(wires=0) @ qml.PauliZ(wires=1))
  
      qnode_def = qml.QNode(circuit, dev_def)
      qnode = qml.QNode(circuit, dev)
  
      grad_def = qml.grad(qnode_def, argnum=[0, 1])
      grad = qml.grad(qnode, argnum=[0, 1])
  
      assert np.allclose(
          qnode(theta, phi), qnode_def(theta, phi), atol=tol(dev.shots)
      )
      assert np.allclose(
          grad(theta, phi), grad_def(theta, phi), atol=tol(dev.shots)
      )
  
file_path: pennylane/pennylane/devices/tests/test_compare_default_qubit.py
imports: import pytest
  from flaky import flaky
  import pennylane
  from pennylane import numpy
  from pennylane.templates.layers import RandomLayers
label_desc: Use image node_id 3 for calling the TestComparison obj's underlying member method code with example usage: obj.test_pauliz_expectation_analytic(device, tol) and returns: qml