class_docstr: Test for caching behaviour
class_docstr_tok: ["Test","for","caching","behaviour"]
docstr: Test the use of a custom cache object with multiple tapes
docstr_tok: ["Test","the","use","of","a","custom","cache","object","with","multiple","tapes"]
code: def test_custom_cache_multiple(self, mocker):
      """Test the use of a custom cache object with multiple tapes"""
      dev = qml.device("default.qubit.legacy", wires=1)
      spy = mocker.spy(qml.workflow, "cache_execute")
  
      a = jax.numpy.array(0.1)
      b = jax.numpy.array(0.2)
  
      def cost(a, b, cache):
          with qml.queuing.AnnotatedQueue() as q1:
              qml.RY(a, wires=0)
              qml.RX(b, wires=0)
              qml.expval(qml.PauliZ(0))
  
          tape1 = qml.tape.QuantumScript.from_queue(q1)
          with qml.queuing.AnnotatedQueue() as q2:
              qml.RY(a, wires=0)
              qml.RX(b, wires=0)
              qml.expval(qml.PauliZ(0))
  
          tape2 = qml.tape.QuantumScript.from_queue(q2)
          res = execute(
              [tape1, tape2],
              dev,
              gradient_fn=param_shift,
              cache=cache,
          )
          return res[0]
  
      custom_cache = {}
      jax.grad(cost)(a, b, cache=custom_cache)
  
      cache = spy.call_args[0][1]
      assert cache is custom_cache
  
imports: import pytest
  import numpy
  import pennylane
  from pennylane.gradients import param_shift
  from pennylane import execute
label_desc: Use image node_id 3 for calling the TestCaching obj's underlying member method code with example usage: obj.test_custom_cache_multiple(mocker) and returns: res