class_docstr: Tests for the map_batch_transform function
class_docstr_tok: ["Tests","for","the","map_batch_transform","function"]
docstr: Test that it correctly applies the transform to be mapped
docstr_tok: ["Test","that","it","correctly","applies","the","transform","to","be","mapped"]
code: def test_result(self, mocker):
      """Test that it correctly applies the transform to be mapped"""
      dev = qml.device("default.qubit.legacy", wires=2)
      H = qml.PauliZ(0) @ qml.PauliZ(1) - qml.PauliX(0)
      x = 0.6
      y = 0.7
  
      with qml.queuing.AnnotatedQueue() as q1:
          qml.RX(x, wires=0)
          qml.RY(y, wires=1)
          qml.CNOT(wires=[0, 1])
          qml.expval(H)
  
      tape1 = qml.tape.QuantumScript.from_queue(q1)
      with qml.queuing.AnnotatedQueue() as q2:
          qml.Hadamard(wires=0)
          qml.CRX(x, wires=[0, 1])
          qml.CNOT(wires=[0, 1])
          qml.expval(H + 0.5 * qml.PauliY(0))
  
      tape2 = qml.tape.QuantumScript.from_queue(q2)
      spy = mocker.spy(qml.transforms, "hamiltonian_expand")
      tapes, fn = qml.transforms.map_batch_transform(
          qml.transforms.hamiltonian_expand, [tape1, tape2]
      )
  
      spy.assert_called()
      assert len(tapes) == 5
  
      res = qml.execute(
          tapes,
          dev,
          qml.gradients.param_shift,
          device_batch_transform=False,
      )
      expected = [
          np.cos(y),
          0.5 + 0.5 * np.cos(x) - 0.5 * np.sin(x / 2),
      ]
  
      assert np.allclose(fn(res), expected)
  
imports: import functools
  import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 1 for calling the TestMapBatchTransform obj's underlying member method code with example usage: obj.test_result(mocker) without return types