class_docstr: Unit tests for clifford compilation function.
class_docstr_tok: ["Unit","tests","for","clifford","compilation","function","."]
docstr: Test decomposition for the Clifford transform.
docstr_tok: ["Test","decomposition","for","the","Clifford","transform","."]
code: def test_one_qubit_decomposition(self, op):
      """Test decomposition for the Clifford transform."""
  
      decomp_ops, global_ops = _one_qubit_decompose(op)
      decomp_ops = _fuse_global_phases(decomp_ops + [global_ops])
  
      valid_gates = _CLIFFORD_PHASE_GATES + (qml.RZ,)
      assert all(
          isinstance(op, valid_gates)
          or isinstance(getattr(op, "base", None), valid_gates)
          for op in decomp_ops
      )
  
      global_op = decomp_ops.pop()
      assert isinstance(global_op, qml.GlobalPhase)
  
      matrix_op = reduce(
          lambda x, y: x @ y,
          [qml.matrix(op) for op in decomp_ops][::-1],
      ) * qml.matrix(global_op)
  
      # check for matrice equivalence up to global phase
      phase = qml.math.divide(
          matrix_op,
          qml.matrix(op),
          out=qml.math.zeros_like(matrix_op, dtype=complex),
          where=matrix_op != 0,
      )[qml.math.nonzero(qml.math.round(matrix_op, 10))]
      assert qml.math.allclose(
          phase / phase[0],
          qml.math.ones(qml.math.shape(phase)[0]),
          atol=1e-5,
      )
  
imports: import math
  from functools import reduce
  import pytest
  import pennylane
  from pennylane.transforms.decompositions.clifford_t_transform import check_clifford_t, clifford_t_decomposition, _rot_decompose, _one_qubit_decompose, _two_qubit_decompose, _CLIFFORD_T_GATES
  from pennylane.transforms.optimization.optimization_utils import _fuse_global_phases
label_desc: Use image node_id 5 for calling the TestCliffordCompile obj's underlying member method code with example usage: obj.test_one_qubit_decomposition(op) without return types