class_docstr: Test the THermitian observable
class_docstr_tok: ["Test","the","THermitian","observable"]
docstr: Tests that the diagonalizing_gates method of the THermitian class
  diagonalizes the given observable.
docstr_tok: ["Tests","that","the","diagonalizing_gates","method","of","the","THermitian","class","diagonalizes","the","given","observable","."]
code: def test_thermitian_diagonalizing_gates_integration(
      self, observable, eigvals, eigvecs, tol
  ):
      """Tests that the diagonalizing_gates method of the THermitian class
      diagonalizes the given observable."""
      tensor_obs = np.kron(observable, observable)
      eigvals = np.kron(eigvals, eigvals)
  
      diag_gates = qml.THermitian(
          tensor_obs, wires=[0, 1]
      ).diagonalizing_gates()
  
      assert len(diag_gates) == 1
  
      U = diag_gates[0].parameters[0]
      x = U @ tensor_obs @ U.conj().T
      assert np.allclose(np.diag(np.sort(eigvals)), x, atol=tol, rtol=0)
  
imports: import functools
  from unittest.mock import PropertyMock, patch
  import pytest
  import numpy
  from gate_data import GELL_MANN
  import pennylane
label_desc: Use image node_id 11 for calling the TestTHermitian obj's underlying member method code with example usage: obj.test_thermitian_diagonalizing_gates_integration(observable, eigvals, eigvecs, tol) without return types