class_docstr: Test the THermitian observable
class_docstr_tok: ["Test","the","THermitian","observable"]
docstr: Tests that the Hermitian matrix method raises the proper errors.
docstr_tok: ["Tests","that","the","Hermitian","matrix","method","raises","the","proper","errors","."]
code: def test_thermitian_exceptions(self):
      """Tests that the Hermitian matrix method raises the proper errors."""
      H_01 = np.array(
          [[1, 1, 0], [1, -1, 0], [0, 0, np.sqrt(2)]]
      ) / np.sqrt(2)
  
      # test non-square matrix
      with pytest.raises(ValueError, match="must be a square matrix"):
          qml.THermitian(H_01[1:], wires=0).matrix()
  
      # test non-Hermitian matrix
      H2 = H_01.copy()
      H2[0, 1] = 2
      with pytest.raises(ValueError, match="must be Hermitian"):
          qml.THermitian(H2, wires=0).matrix()
  
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 13 for calling the TestTHermitian obj's underlying member method code with example usage: obj.test_thermitian_exceptions() without return types