code: def test_LRU_cache13(self):
      # test if plan insertion respect the memory size limit
      cache = config.get_plan_cache()
      cache.set_memsize(1024)
  
      # ensure a fresh state
      assert cache.get_curr_size() == 0 <= cache.get_size()
  
      # On CUDA 10.0 + sm75, this generates a plan of size 1024 bytes
      a = testing.shaped_random((128,), cupy, cupy.complex64)
      cupy.fft.ifft(a)
      assert cache.get_curr_size() == 1 <= cache.get_size()
      assert cache.get_curr_memsize() == 1024 == cache.get_memsize()
  
      # a second plan (of same size) is generated, but the cache is full,
      # so the first plan is evicted
      a = testing.shaped_random((64,), cupy, cupy.complex128)
      cupy.fft.ifft(a)
      assert cache.get_curr_size() == 1 <= cache.get_size()
      assert cache.get_curr_memsize() == 1024 == cache.get_memsize()
      plan = next(iter(cache))[1].plan
  
      # this plan is twice as large, so won't fit in
      a = testing.shaped_random((128,), cupy, cupy.complex128)
      with pytest.raises(RuntimeError) as e:
          cupy.fft.ifft(a)
      assert "memsize is too large" in str(e.value)
      # the cache remains intact
      assert cache.get_curr_size() == 1 <= cache.get_size()
      assert cache.get_curr_memsize() == 1024 == cache.get_memsize()
      plan1 = next(iter(cache))[1].plan
      assert plan1 is plan
  
      # double the cache size would make the plan just fit (and evict
      # the existing one)
      cache.set_memsize(2048)
      cupy.fft.ifft(a)
      assert cache.get_curr_size() == 1 <= cache.get_size()
      assert cache.get_curr_memsize() == 2048 == cache.get_memsize()
      plan2 = next(iter(cache))[1].plan
      assert plan2 is not plan
  
imports: import contextlib
  import io
  import queue
  import threading
  import unittest
  import pytest
  import cupy
  from cupy import testing
  from cupy.cuda import cufft
  from cupy.cuda import device
  from cupy.cuda import runtime
  from cupy.fft import config
  from .test_fft import multi_gpu_config, _skip_multi_gpu_bug
label_desc: Use image node_id 15 for calling the TestPlanCache obj's underlying member method code with example usage: obj.test_LRU_cache13() without return types