code: def test_disk(self):
      cache = Disk(os.path.join(lore.env.DATA_DIR, "cache"))
  
      for key in cache.keys():
          del cache[key]
  
      self.assertEqual(len(cache), 0)
      self.assertEqual(cache["a"], None)
      self.assertEqual(cache.keys(), [])
  
      cache["a"] = 1
      self.assertEqual(len(cache), 1)
      self.assertEqual(cache["a"], 1)
      self.assertEqual(cache.keys(), ["a"])
  
      time.sleep(1)  # disk cache LRU has 1 second precision
  
      cache["b"] = 2
      self.assertEqual(len(cache), 2)
      self.assertEqual(cache.lru(), "a")
      self.assertEqual(cache["b"], 2)
      self.assertEqual(sorted(cache.keys()), ["a", "b"])
  
      cache["b"] = 3
      self.assertEqual(len(cache), 2)
      self.assertEqual(cache.lru(), "a")
      self.assertEqual(cache["b"], 3)
      self.assertEqual(sorted(cache.keys()), ["a", "b"])
  
      del cache["b"]
      self.assertEqual(len(cache), 1)
      self.assertEqual(cache.lru(), "a")
      self.assertFalse("b" in cache)
      self.assertEqual(cache.keys(), ["a"])
  
      cache.limit = 0
      self.assertRaises(MemoryError, cache.__setitem__, "a", 1)
      del cache["a"]
  
      self.assertEqual(len(cache), 0)
      self.assertEqual(cache.lru(), None)
      self.assertFalse("a" in cache)
      self.assertEqual(cache.keys(), [])
  
file_path: lore/tests/unit/test_stores.py
imports: import datetime
  import unittest
  import os
  import time
  import lore
  from lore.stores import query_cached
  from lore.stores.disk import Disk
label_desc: Use image node_id 3 for calling the TestDisk obj's underlying member method code with example usage: obj.test_disk() without return types