class_docstr: Tests for single-qubit gates being pushed through controlled gates.
class_docstr_tok: ["Tests","for","single-qubit","gates","being","pushed","through","controlled","gates","."]
docstr: Test that gates do not get pushed through controlled gates whose target bases don't match.
docstr_tok: ["Test","that","gates","do","not","get","pushed","through","controlled","gates","whose","target","bases","do","n't","match","."]
code: def test_gate_blocked_different_basis(self, direction):
      """Test that gates do not get pushed through controlled gates whose target bases don't match."""
  
      def qfunc():
          qml.PauliZ(wires="b")
          qml.CNOT(wires=[2, "b"])
          qml.PauliY(wires="b")
  
      transformed_qfunc = commute_controlled(qfunc, direction=direction)
  
      ops = qml.tape.make_qscript(transformed_qfunc)().operations
  
      names_expected = ["PauliZ", "CNOT", "PauliY"]
      wires_expected = [Wires("b"), Wires([2, "b"]), Wires("b")]
      compare_operation_lists(ops, names_expected, wires_expected)
  
imports: import pytest
  from utils import compare_operation_lists, check_matrix_equivalence
  import pennylane
  from pennylane import numpy
  from pennylane.wires import Wires
  from pennylane.transforms.optimization import commute_controlled
label_desc: Use image node_id 3 for calling the TestCommuteControlled obj's underlying member method code with example usage: obj.test_gate_blocked_different_basis(direction) without return types