Spaces:
Running on Zero
Running on Zero
| """Bounded cache behavior.""" | |
| from core.cache import LRUCache | |
| def test_lru_cache_promotes_reads_before_eviction() -> None: | |
| cache: LRUCache[str, int] = LRUCache(capacity=2) | |
| assert cache.put("a", 1) is None | |
| assert cache.put("b", 2) is None | |
| assert cache.get("a") == 1 | |
| assert cache.put("c", 3) == ("b", 2) | |
| assert cache.get("a") == 1 | |
| assert cache.get("c") == 3 | |