[Bugfix] Skip MM processor cache inserts larger than capacity (#53016)
Signed-off-by: Prudhvivuda <prudhvi12042001@gmail.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
import pytest
|
||||
|
||||
from vllm.utils.cache import CacheInfo, LRUCache
|
||||
|
||||
|
||||
@@ -123,3 +125,16 @@ def test_lru_cache():
|
||||
assert 2 in cache
|
||||
assert 4 in cache
|
||||
assert 6 in cache
|
||||
|
||||
|
||||
def test_lru_cache_put_if_fits():
|
||||
cache = LRUCache(10, getsizeof=lambda x: x)
|
||||
|
||||
assert cache.put_if_fits("ok", 4) is True
|
||||
assert cache["ok"] == 4
|
||||
|
||||
assert cache.put_if_fits("big", 11) is False
|
||||
assert "big" not in cache
|
||||
|
||||
with pytest.raises(ValueError, match="value too large"):
|
||||
cache.put("big", 11)
|
||||
|
||||
Reference in New Issue
Block a user