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 Z-basis after before controlled-Z-type gates on controls *and*
  targets get pushed behind.
docstr_tok: ["Test","that","Z-basis","after","before","controlled-Z-type","gates","on","controls","*","and","*","targets","get","pushed","behind","."]
code: def test_push_z_gates_left(self):
      """Test that Z-basis after before controlled-Z-type gates on controls *and*
      targets get pushed behind."""
  
      def qfunc():
          qml.CZ(wires=[0, 2])
          qml.PauliZ(wires=2)
          qml.S(wires=0)
  
          qml.CNOT(wires=[0, 1])
  
          qml.CRZ(0.5, wires=[0, 1])
          qml.RZ(0.2, wires=2)
          qml.T(wires=0)
          qml.PauliZ(wires=0)
  
      transformed_qfunc = commute_controlled(qfunc, direction="left")
  
      ops = qml.tape.make_qscript(transformed_qfunc)().operations
  
      names_expected = [
          "PauliZ",
          "S",
          "RZ",
          "T",
          "PauliZ",
          "CZ",
          "CNOT",
          "CRZ",
      ]
      wires_expected = [
          Wires(2),
          Wires(0),
          Wires(2),
          Wires(0),
          Wires(0),
          Wires([0, 2]),
      ] + [Wires([0, 1])] * 2
  
      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 11 for calling the TestCommuteControlled obj's underlying member method code with example usage: obj.test_push_z_gates_left() without return types