class_docstr: Unit tests for the preprocessing method.
class_docstr_tok: ["Unit","tests","for","the","preprocessing","method","."]
docstr: Test that preprocessing swaps out any MP with no wires or obs
docstr_tok: ["Test","that","preprocessing","swaps","out","any","MP","with","no","wires","or","obs"]
code: def test_measurement_is_swapped_out(self, mp_fn, mp_cls, shots):
      """Test that preprocessing swaps out any MP with no wires or obs"""
      dev = DefaultQubit(wires=3)
      original_mp = mp_fn()
      exp_z = qml.expval(qml.PauliZ(0))
      qs = qml.tape.QuantumScript(
          [qml.Hadamard(0)], [original_mp, exp_z], shots=shots
      )
      program, _ = dev.preprocess()
      tapes, _ = program([qs])
      assert len(tapes) == 1
      tape = tapes[0]
      assert tape.operations == qs.operations
      assert tape.measurements != qs.measurements
      assert qml.equal(tape.measurements[0], mp_cls(wires=[0, 1, 2]))
      assert tape.measurements[1] is exp_z
  
imports: import pytest
  import numpy
  import pennylane
  from pennylane.devices import DefaultQubit, ExecutionConfig
  from pennylane.devices.default_qubit import stopping_condition
label_desc: Use image node_id 5 for calling the TestPreprocessing obj's underlying member method code with example usage: obj.test_measurement_is_swapped_out(mp_fn, mp_cls, shots) without return types