Spaces:
Running on Zero
Running on Zero
Download tests/test_cache.py from basyx/ai-gateway: direct link, hf CLI and curl.
- Browser
- Download file 388 Bytes
-
https://huggingface.co/spaces/basyx/ai-gateway/resolve/main/tests/test_cache.py
- Command line
-
hf download hf://spaces/basyx/ai-gateway/tests/test_cache.py
-
curl -L -o test_cache.py https://huggingface.co/spaces/basyx/ai-gateway/resolve/main/tests/test_cache.py
388 Bytes
| """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 | |