[MyPy][2/N] Fix mypy errors in small tests/ dirs (#51043)
Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Harry Mellor
Claude Opus 5.5
parent
a96ee5935d
commit
5dd693122c
@@ -114,7 +114,8 @@ async def test_bge_m3_sparse_plugin_online(
|
||||
response = ret.json()
|
||||
|
||||
# Verify the request response is in the correct format
|
||||
assert (parsed_response := IOProcessorResponse(**response).data)
|
||||
parsed_response: object = IOProcessorResponse(**response).data
|
||||
assert parsed_response
|
||||
|
||||
# Verify the output is formatted as expected for this plugin
|
||||
assert _get_attr_or_val(parsed_response, "data")
|
||||
|
||||
@@ -79,7 +79,7 @@ def _post_pooling(server: RemoteOpenAIServer, data: dict):
|
||||
ret = requests.post(server.url_for("pooling"), json=request_payload)
|
||||
ret.raise_for_status()
|
||||
response = ret.json()
|
||||
parsed_response = IOProcessorResponse(**response).data
|
||||
parsed_response: object = IOProcessorResponse(**response).data
|
||||
assert parsed_response
|
||||
return parsed_response
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ async def test_init_state_is_noop_without_phase_a(monkeypatch: pytest.MonkeyPatc
|
||||
monkeypatch.setenv("VLLM_PLUGINS", "dummy_admin_endpoint_plugin")
|
||||
|
||||
state = State()
|
||||
await init_endpoint_plugins_state(_FakeEngineClient(), state, _build_args())
|
||||
await init_endpoint_plugins_state(_FakeEngineClient(), state, _build_args()) # type: ignore[arg-type]
|
||||
|
||||
assert not hasattr(state, "dummy_engine_client")
|
||||
|
||||
@@ -223,7 +223,7 @@ async def test_endpoint_plugin_end_to_end(monkeypatch: pytest.MonkeyPatch):
|
||||
)
|
||||
|
||||
fake_engine_client = _FakeEngineClient(rpc_result=["cfg-a", "cfg-b"])
|
||||
await init_endpoint_plugins_state(fake_engine_client, app.state, args)
|
||||
await init_endpoint_plugins_state(fake_engine_client, app.state, args) # type: ignore[arg-type]
|
||||
|
||||
assert app.state.dummy_engine_client is fake_engine_client
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ def test_oot_registration_multimodal(
|
||||
)
|
||||
|
||||
first_token = llm.get_tokenizer().decode(0)
|
||||
outputs = llm.generate(prompts, sampling_params)
|
||||
outputs = llm.generate(prompts, sampling_params) # type: ignore[arg-type]
|
||||
|
||||
for output in outputs:
|
||||
generated_text = output.outputs[0].text
|
||||
|
||||
@@ -23,7 +23,8 @@ def test_stat_logger_plugin_is_discovered(monkeypatch: pytest.MonkeyPatch):
|
||||
# instantiate and confirm the right type
|
||||
vllm_config = VllmConfig()
|
||||
instance = factories[0](vllm_config)
|
||||
assert isinstance(instance, DummyStatLogger)
|
||||
# The `is` check above narrows DummyStatLogger to a Callable
|
||||
assert isinstance(instance, DummyStatLogger) # type: ignore[arg-type]
|
||||
|
||||
|
||||
def test_no_plugins_loaded_if_env_empty(monkeypatch: pytest.MonkeyPatch):
|
||||
@@ -66,10 +67,11 @@ async def test_stat_logger_plugin_integration_with_engine(
|
||||
|
||||
engine = AsyncLLM.from_engine_args(engine_args=engine_args)
|
||||
|
||||
assert engine.logger_manager is not None
|
||||
assert len(engine.logger_manager.stat_loggers) == 2
|
||||
assert len(engine.logger_manager.stat_loggers[0].per_engine_stat_loggers) == 1
|
||||
assert len(engine.logger_manager.stat_loggers[0].per_engine_stat_loggers) == 1 # type: ignore[attr-defined]
|
||||
assert isinstance(
|
||||
engine.logger_manager.stat_loggers[0].per_engine_stat_loggers[0],
|
||||
engine.logger_manager.stat_loggers[0].per_engine_stat_loggers[0], # type: ignore[attr-defined]
|
||||
DummyStatLogger,
|
||||
)
|
||||
|
||||
|
||||
@@ -95,7 +95,8 @@ async def test_prithvi_mae_plugin_online(
|
||||
response = ret.json()
|
||||
|
||||
# verify the request response is in the correct format
|
||||
assert (parsed_response := IOProcessorResponse(**response))
|
||||
parsed_response: IOProcessorResponse = IOProcessorResponse(**response)
|
||||
assert parsed_response
|
||||
|
||||
# verify the output is formatted as expected for this plugin
|
||||
plugin_data = parsed_response.data
|
||||
|
||||
Reference in New Issue
Block a user