code: def test_scipy__cache_replacement(compile_cache_size: int) -> None:
      opt = gpflow.optimizers.Scipy(
          compile_cache_size=compile_cache_size
      )
  
      # Create more closures and variables than the cache can hold
      variables = [
          tf.Variable(float(i)) for i in range(compile_cache_size + 1)
      ]
      closures = [_loss_closure_builder([0], var) for var in variables]
  
      # Fill the cache
      for i in range(compile_cache_size):
          opt.eval_func(closures[i], [variables[i]], tf_fun_args={})
          assert len(opt.compile_cache) == i + 1
  
      # Add one more closure to force the cache to replace the oldest entry
      opt.eval_func(closures[-1], [variables[-1]], tf_fun_args={})
      assert len(opt.compile_cache) == compile_cache_size
      assert set(opt.compile_cache.keys()) == set(
          [
              (closures[i], (id(variables[i]),), frozenset(), False)
              for i in range(1, compile_cache_size + 1)
          ]
      )
  
imports: import unittest
  import warnings
  from typing import Any, Callable, Dict, List, Sequence, Tuple
  from unittest.mock import MagicMock
  import numpy
  import pytest
  import tensorflow
  from packaging.version import Version
  import gpflow
  from gpflow.base import AnyNDArray
  from gpflow.config import default_float
  from gpflow.models import GPR, GPModel
  from gpflow.optimizers.scipy import LossClosure
label_desc: Use image node_id 11 for calling a global function with example usage: test_scipy__cache_replacement(compile_cache_size) without return types