MCPcopy Create free account
hub / github.com/IBM/mcp-cli / test_eviction

Method test_eviction

tests/chat/state/test_cache.py:86–96  ·  view source on GitHub ↗

Test LRU eviction when cache is full.

(self)

Source from the content-addressed store, hash-verified

84 assert cache.duplicate_count == 0
85
86 def test_eviction(self):
87 """Test LRU eviction when cache is full."""
88 cache = ResultCache(max_size=3)
89 cache.put("tool1", {"x": 1}, 1)
90 cache.put("tool2", {"x": 2}, 2)
91 cache.put("tool3", {"x": 3}, 3)
92 cache.put("tool4", {"x": 4}, 4)
93
94 # First entry should be evicted
95 assert cache.get("tool1", {"x": 1}) is None
96 assert cache.get("tool4", {"x": 4}) is not None
97
98 def test_get_stats(self, cache):
99 """Test get_stats returns correct info."""

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected