class_docstr: Tests for the QutritUnitary class.
class_docstr_tok: ["Tests","for","the","QutritUnitary","class","."]
docstr: Test that the matrix representation is defined correctly
docstr_tok: ["Test","that","the","matrix","representation","is","defined","correctly"]
code: def test_matrix_representation(self):
      """Test that the matrix representation is defined correctly"""
      U = (
          np.array(
              [[1, -1j, -1 + 1j], [1j, 1, 1 + 1j], [1 + 1j, -1 + 1j, 0]]
          )
          * 0.5
      )
  
      res_static = qml.QutritUnitary.compute_matrix(U)
      res_dynamic = qml.QutritUnitary(U, wires=0).matrix()
      expected = U
      assert np.allclose(res_static, expected)
      assert np.allclose(res_dynamic, expected)
  
imports: import pytest
  import numpy
  from scipy.stats import unitary_group
  from gate_data import TSWAP
  import pennylane
  from pennylane.wires import Wires
  from pennylane.operation import DecompositionUndefinedError
label_desc: Use image node_id 11 for calling the TestQutritUnitary obj's underlying member method code with example usage: obj.test_matrix_representation() without return types