(self)
| 113 | """Tests for longer prefix match behavior (trimming).""" |
| 114 | |
| 115 | def setUp(self): |
| 116 | # Track trim calls for verification |
| 117 | self.trim_calls = [] |
| 118 | |
| 119 | def mock_can_trim(cache): |
| 120 | return True |
| 121 | |
| 122 | def mock_trim(cache, num_to_trim): |
| 123 | self.trim_calls.append(num_to_trim) |
| 124 | # Simulate trimming by modifying the cache |
| 125 | cache.append(f"trimmed_{num_to_trim}") |
| 126 | |
| 127 | self.cache = ThreadSafeLRUPromptCache( |
| 128 | max_size=10, |
| 129 | can_trim_fn=mock_can_trim, |
| 130 | trim_fn=mock_trim, |
| 131 | ) |
| 132 | |
| 133 | def test_longer_prefix_triggers_trim(self): |
| 134 | """When cached sequence is longer, should trim to match requested prefix.""" |
nothing calls this directly
no test coverage detected