Disable mypy arg-type and assignment checks in tests (#59428)
Signed-off-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
Claude Opus 5.5
parent
17e9295dd5
commit
fc2c801ad9
@@ -48,9 +48,9 @@ def _validate(
|
||||
) -> StructuredOutputsParams:
|
||||
params = SamplingParams(structured_outputs=StructuredOutputsParams(grammar=grammar))
|
||||
params._validate_structured_outputs(
|
||||
_StubModelConfig(), # type: ignore[arg-type]
|
||||
_StubModelConfig(),
|
||||
StructuredOutputsConfig(backend=backend),
|
||||
tokenizer=tokenizer or object(), # type: ignore[arg-type]
|
||||
tokenizer=tokenizer or object(),
|
||||
)
|
||||
assert params.structured_outputs is not None
|
||||
return params.structured_outputs
|
||||
|
||||
@@ -51,7 +51,7 @@ def make_vllm_config() -> VllmConfig:
|
||||
config = VllmConfig(
|
||||
structured_outputs_config=StructuredOutputsConfig(backend="xgrammar"),
|
||||
)
|
||||
config.model_config = SimpleNamespace( # type: ignore[assignment]
|
||||
config.model_config = SimpleNamespace(
|
||||
hf_config=SimpleNamespace(model_type="plamo3")
|
||||
)
|
||||
return config
|
||||
@@ -73,7 +73,7 @@ def test_plamo3_python_tokenizer_compiles_and_accepts_structural_tag():
|
||||
tokenizer = Plamo3Tokenizer(["<eos>", *call_tokens])
|
||||
backend = XgrammarBackend(
|
||||
make_vllm_config(),
|
||||
tokenizer=tokenizer, # type: ignore[arg-type]
|
||||
tokenizer=tokenizer,
|
||||
vocab_size=len(tokenizer.get_vocab()),
|
||||
)
|
||||
tools = [
|
||||
@@ -107,7 +107,7 @@ def test_plamo3_grammar_matches_decoded_bytes(value):
|
||||
tokenizer = Plamo3Tokenizer(list(dict.fromkeys(["<eos>", value, *pieces])))
|
||||
backend = XgrammarBackend(
|
||||
make_vllm_config(),
|
||||
tokenizer=tokenizer, # type: ignore[arg-type]
|
||||
tokenizer=tokenizer,
|
||||
vocab_size=len(tokenizer.get_vocab()),
|
||||
)
|
||||
for tokens in ([value], pieces):
|
||||
|
||||
@@ -108,7 +108,7 @@ def _build_harness(
|
||||
)
|
||||
manager = StructuredOutputManager(vllm_config)
|
||||
if use_reasoner:
|
||||
manager.reasoner_cls = MockReasoner # type: ignore[assignment]
|
||||
manager.reasoner_cls = MockReasoner
|
||||
|
||||
sampling_params = SamplingParams(
|
||||
structured_outputs=structured_outputs
|
||||
|
||||
@@ -35,7 +35,7 @@ def test_structured_outputs_rejected_for_diffusion_models():
|
||||
)
|
||||
with pytest.raises(VLLMValidationError, match="not yet supported for diffusion"):
|
||||
params._validate_structured_outputs(
|
||||
_StubModelConfig(is_diffusion=True), # type: ignore[arg-type]
|
||||
_StubModelConfig(is_diffusion=True),
|
||||
StructuredOutputsConfig(),
|
||||
tokenizer=None,
|
||||
)
|
||||
@@ -45,7 +45,7 @@ def test_plain_request_allowed_for_diffusion_models():
|
||||
"""Requests without structured outputs are unaffected by the guard."""
|
||||
params = SamplingParams()
|
||||
params._validate_structured_outputs(
|
||||
_StubModelConfig(is_diffusion=True), # type: ignore[arg-type]
|
||||
_StubModelConfig(is_diffusion=True),
|
||||
StructuredOutputsConfig(),
|
||||
tokenizer=None,
|
||||
)
|
||||
@@ -71,9 +71,9 @@ def test_degenerate_structured_outputs_rejected(structured_outputs, match):
|
||||
params = SamplingParams(structured_outputs=structured_outputs)
|
||||
with pytest.raises(VLLMValidationError, match=match):
|
||||
params._validate_structured_outputs(
|
||||
_StubModelConfig(is_diffusion=False), # type: ignore[arg-type]
|
||||
_StubModelConfig(is_diffusion=False),
|
||||
StructuredOutputsConfig(),
|
||||
tokenizer=object(), # type: ignore[arg-type]
|
||||
tokenizer=object(),
|
||||
)
|
||||
|
||||
|
||||
@@ -97,9 +97,9 @@ def test_regex_with_nul_byte_rejected(regex):
|
||||
# (which would otherwise catch the error and fall back to another backend).
|
||||
with pytest.raises(VLLMValidationError, match="NUL"):
|
||||
params._validate_structured_outputs(
|
||||
_StubModelConfig(is_diffusion=False), # type: ignore[arg-type]
|
||||
_StubModelConfig(is_diffusion=False),
|
||||
StructuredOutputsConfig(),
|
||||
tokenizer=object(), # type: ignore[arg-type]
|
||||
tokenizer=object(),
|
||||
)
|
||||
|
||||
# The xgrammar backend also rejects it directly (defense in depth), before
|
||||
@@ -133,9 +133,9 @@ def test_unsupported_grammar_is_a_client_error(backend, structured_outputs):
|
||||
params = SamplingParams(structured_outputs=structured_outputs)
|
||||
with pytest.raises(VLLMClientError):
|
||||
params._validate_structured_outputs(
|
||||
_StubModelConfig(is_diffusion=False), # type: ignore[arg-type]
|
||||
_StubModelConfig(is_diffusion=False),
|
||||
StructuredOutputsConfig(backend=backend),
|
||||
tokenizer=object(), # type: ignore[arg-type]
|
||||
tokenizer=object(),
|
||||
)
|
||||
|
||||
|
||||
@@ -180,9 +180,9 @@ def test_auto_backend_falls_back_on_unsupported_schema(schema, expected_backend)
|
||||
"""`auto` falls back on rejection, so it must catch what the validators raise."""
|
||||
params = SamplingParams(structured_outputs=StructuredOutputsParams(json=schema))
|
||||
params._validate_structured_outputs(
|
||||
_StubModelConfig(is_diffusion=False), # type: ignore[arg-type]
|
||||
_StubModelConfig(is_diffusion=False),
|
||||
StructuredOutputsConfig(backend="auto"),
|
||||
tokenizer=object(), # type: ignore[arg-type]
|
||||
tokenizer=object(),
|
||||
)
|
||||
assert params.structured_outputs is not None
|
||||
assert params.structured_outputs._backend == expected_backend
|
||||
|
||||
Reference in New Issue
Block a user