class_docstr: Tests for the qubit reuse/reset functionality of `qml.measure`.
docstr: Test that a QNode with multiple mid-circuit measurements with
  different resets is transformed correctly.
docstr_tok: ["Test","that","a","QNode","with","multiple","mid-circuit","measurements","with","different","resets","is","transformed","correctly","."]
code: def test_multiple_measurements_mixed_reset(self, mocker):
      """Test that a QNode with multiple mid-circuit measurements with
      different resets is transformed correctly."""
      dev = qml.device("default.qubit", wires=6)
  
      @qml.qnode(dev)
      def qnode(p, x, y):
          qml.Hadamard(0)
          qml.PhaseShift(p, 0)
          # Set measurement_ids so that the order of wires in combined
          # measurement values is consistent
  
          mp0 = qml.measurements.MidMeasureMP(0, reset=True, id=0)
          m0 = qml.measurements.MeasurementValue([mp0], lambda v: v)
          qml.cond(~m0, qml.RX)(x, 1)
          mp1 = qml.measurements.MidMeasureMP(1, reset=True, id=1)
          m1 = qml.measurements.MeasurementValue([mp1], lambda v: v)
          qml.cond(m0 & m1, qml.Hadamard)(0)
          mp2 = qml.measurements.MidMeasureMP(0, id=2)
          m2 = qml.measurements.MeasurementValue([mp2], lambda v: v)
          qml.cond(m1 | m2, qml.RY)(y, 2)
          return qml.expval(qml.PauliZ(2))
  
      spy = mocker.spy(qml.defer_measurements, "_transform")
      _ = qnode(0.123, 0.456, 0.789)
      assert spy.call_count == 1
  
      expected_circuit = [
          qml.Hadamard(0),
          qml.PhaseShift(0.123, 0),
          qml.CNOT([0, 3]),
          qml.CNOT([3, 0]),
          qml.ops.Controlled(qml.RX(0.456, 1), 3, [False]),
          qml.CNOT([1, 4]),
          qml.CNOT([4, 1]),
          qml.ops.Controlled(qml.Hadamard(0), [3, 4]),
          qml.CNOT([0, 5]),
          qml.ops.Controlled(qml.RY(0.789, 2), [4, 5], [False, True]),
          qml.ops.Controlled(qml.RY(0.789, 2), [4, 5], [True, False]),
          qml.ops.Controlled(qml.RY(0.789, 2), [4, 5], [True, True]),
          qml.expval(qml.PauliZ(2)),
      ]
  
      deferred_tapes, _ = qml.defer_measurements(qnode.qtape)
      deferred_tape = deferred_tapes[0]
      assert len(deferred_tape.circuit) == len(expected_circuit)
      assert all(
          qml.equal(actual, expected)
          for actual, expected in zip(
              deferred_tape.circuit, expected_circuit
          )
      )
  
imports: import math
  import pytest
  import pennylane
  from pennylane.measurements import MidMeasureMP, MeasurementValue
  import pennylane.numpy
  from pennylane.devices import DefaultQubit
label_desc: Use image node_id 5 for calling the TestQubitReuseAndReset obj's underlying member method code with example usage: obj.test_multiple_measurements_mixed_reset(mocker) and returns: qml