class_docstr: Test for caching behaviour
class_docstr_tok: ["Test","for","caching","behaviour"]
docstr: Test the cachesize property of the cache
docstr_tok: ["Test","the","cachesize","property","of","the","cache"]
code: def test_cache_maxsize(self, mocker):
      """Test the cachesize property of the cache"""
      dev = qml.device("default.qubit.legacy", wires=1)
      spy = mocker.spy(qml.workflow, "cache_execute")
      a = tf.Variable([0.1, 0.2])
  
      with tf.GradientTape() as t:
          with qml.queuing.AnnotatedQueue() as q:
              qml.RY(a[0], wires=0)
              qml.RX(a[1], wires=0)
              qml.probs(wires=0)
  
          tape = qml.tape.QuantumScript.from_queue(q)
          res = execute(
              [tape],
              dev,
              gradient_fn=param_shift,
              cachesize=2,
              interface="tf",
          )[0]
  
      t.jacobian(res, a)
      cache = spy.call_args[0][1]
  
      assert cache.maxsize == 2
      assert cache.currsize == 2
      assert len(cache) == 2
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane.gradients import finite_diff, param_shift
  from pennylane import execute
label_desc: Use image node_id 1 for calling the TestCaching obj's underlying member method code with example usage: obj.test_cache_maxsize(mocker) without return types