[CI/Build] Fix pre-commit (#59426)
Cyrus Leung committed
Sep 30, 2026 at 21:45 UTC
677e3f5d5040db80087fd5693cd3434d1adcde83
1 file changed
+9
-1
tests/multimodal/test_cache.py
+9
-1
@@ -2,6 +2,7 @@
2
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
import multiprocessing as mp
4
from types import SimpleNamespace
5
+from typing import cast
6
from unittest.mock import Mock
7
8
import numpy as np
@@ -796,6 +797,7 @@ def test_shm_receiver_requires_sender_handle_for_current_cache_key():
797
798
try:
799
sender_item, _ = sender_cache.get_and_update_item((item, []), mm_hash)
800
+ assert sender_item is not None
801
802
valid_feature = MultiModalFeatureSpec(
803
data=sender_item,
@@ -897,10 +899,12 @@ def test_shm_sender_validates_client_supplied_handles():
899
handle, _ = sender_cache.get_and_update_item(
900
(MultiModalKwargsItem.dummy(1024), []), mm_hash
901
)
902
+ assert handle is not None
903
+
904
sender_cache.validate_input_item(handle, mm_hash)
905
sender_cache.validate_input_item(MultiModalKwargsItem.dummy(16), mm_hash)
906
903
- signature = handle["signature"].data
907
+ signature = cast(list[int], handle["signature"].data)
908
forged = [
909
_with_elem(handle, "signature", [signature[0] ^ 1, *signature[1:]]),
910
_with_elem(handle, "signature", [signature]),
@@ -934,6 +938,8 @@ def test_shm_receiver_rejects_out_of_range_handle_fields():
938
handle, _ = sender_cache.get_and_update_item(
939
(MultiModalKwargsItem.dummy(1024), []), mm_hash
940
)
941
+ assert handle is not None
942
+
943
for key, value in [
944
("address", -1),
945
("address", 2**64),
@@ -967,6 +973,8 @@ def test_shm_handle_issued_before_cache_clear():
973
974
try:
975
stale_item, _ = sender_cache.get_and_update_item((item, []), mm_hash)
976
+ assert stale_item is not None
977
+
978
sender_cache.clear_cache()
979
980
# A request still draining after the clear resolves to its own data.