From 7bc97265c064f9e127e99d4dde68a42070a6a948 Mon Sep 17 00:00:00 2001 From: msparsh13 Date: Sat, 5 Sep 2026 11:45:50 +0530 Subject: [PATCH 1/5] test: cover OpenAI compatible execution validation --- tests/test_build_ai_vlm_checks.py | 117 +++++++++++++++++++++++++++++- 1 file changed, 114 insertions(+), 3 deletions(-) diff --git a/tests/test_build_ai_vlm_checks.py b/tests/test_build_ai_vlm_checks.py index 5e27e79b..5715641d 100644 --- a/tests/test_build_ai_vlm_checks.py +++ b/tests/test_build_ai_vlm_checks.py @@ -105,12 +105,123 @@ def test_build_ai_check_version_changes_with_hosted_check_version(tmp_path: Path @pytest.mark.parametrize( - ("endpoint", "model", "expected_message"), + ("kwargs", "expected_message"), [ - ("localhost:8000/v1", "model", "absolute http"), - ("http://localhost:8000/v1", " ", "model must not be empty"), + ( + { + "endpoint": "localhost:8000/v1", + "model": "model", + }, + "absolute http", + ), + ( + { + "endpoint": "http://localhost:8000/v1", + "model": " ", + }, + "model must not be empty", + ), + ( + { + "endpoint": "http://localhost:8000/v1", + "model": " model ", + }, + "model must not have leading or trailing whitespace", + ), + ( + { + "endpoint": "http://localhost:8000/v1", + "model": "model", + "response_format": "json", + }, + "response_format must be", + ), + ( + { + "endpoint": "http://localhost:8000/v1", + "model": "model", + "api_key_environment_variable": "INVALID-NAME", + }, + "valid environment variable name", + ), + ( + { + "endpoint": "http://localhost:8000/v1", + "model": "model", + "max_tokens": "32", + }, + "max_tokens must be an integer", + ), + ( + { + "endpoint": "http://localhost:8000/v1", + "model": "model", + "max_tokens": 0, + }, + "max_tokens must be greater than zero", + ), + ( + { + "endpoint": "http://localhost:8000/v1", + "model": "model", + "max_retries": "5", + }, + "max_retries must be an integer", + ), + ( + { + "endpoint": "http://localhost:8000/v1", + "model": "model", + "max_retries": -1, + }, + "max_retries must not be negative", + ), + ( + { + "endpoint": "http://localhost:8000/v1", + "model": "model", + "temperature": float("nan"), + }, + "temperature must be finite", + ), + ( + { + "endpoint": "http://localhost:8000/v1", + "model": "model", + "max_tokens": True, + }, + "max_tokens must be an integer", + ), + ( + { + "endpoint": "http://localhost:8000/v1", + "model": "model", + "max_retries": True, + }, + "max_retries must be an integer", + ), ], ) +def test_openai_compatible_execution_accepts_valid_configuration() -> None: + execution = hflow.build_ai_vlm_checks.OpenAICompatibleExecution( + endpoint="http://localhost:8000/v1", + model="model", + api_key_environment_variable="TEST_MODEL_API_KEY", + response_format=hflow.build_ai_vlm_checks.ResponseFormat.JSON_SCHEMA, + temperature=0.2, + max_tokens=32, + max_retries=5, + ) + + assert execution.endpoint == "http://localhost:8000/v1" + assert execution.model == "model" + assert execution.api_key_environment_variable == "TEST_MODEL_API_KEY" + assert execution.response_format is hflow.build_ai_vlm_checks.ResponseFormat.JSON_SCHEMA + assert execution.temperature == 0.2 + assert execution.max_tokens == 32 + assert execution.max_retries == 5 + + def test_openai_compatible_execution_refuses_invalid_configuration( endpoint: str, model: str, From 21c317ee4adc2e0b164cbab024fad7ec462e4f32 Mon Sep 17 00:00:00 2001 From: msparsh13 Date: Sat, 5 Sep 2026 11:57:31 +0530 Subject: [PATCH 2/5] test: cover OpenAI compatible execution validation --- tests/test_build_ai_vlm_checks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_build_ai_vlm_checks.py b/tests/test_build_ai_vlm_checks.py index 5715641d..17d454a7 100644 --- a/tests/test_build_ai_vlm_checks.py +++ b/tests/test_build_ai_vlm_checks.py @@ -105,7 +105,7 @@ def test_build_ai_check_version_changes_with_hosted_check_version(tmp_path: Path @pytest.mark.parametrize( - ("kwargs", "expected_message"), + ("endpoint", "model", "expected_message"), [ ( { From 1bd76768e421fee3dd3b0dffa2af66716422b94e Mon Sep 17 00:00:00 2001 From: msparsh13 Date: Sat, 5 Sep 2026 12:05:57 +0530 Subject: [PATCH 3/5] test: cover OpenAI compatible execution validation --- tests/test_build_ai_vlm_checks.py | 165 ++++++++++++++++++------------ 1 file changed, 101 insertions(+), 64 deletions(-) diff --git a/tests/test_build_ai_vlm_checks.py b/tests/test_build_ai_vlm_checks.py index 17d454a7..159284b2 100644 --- a/tests/test_build_ai_vlm_checks.py +++ b/tests/test_build_ai_vlm_checks.py @@ -105,103 +105,140 @@ def test_build_ai_check_version_changes_with_hosted_check_version(tmp_path: Path @pytest.mark.parametrize( - ("endpoint", "model", "expected_message"), + ( + "endpoint", + "model", + "response_format", + "api_key_environment_variable", + "temperature", + "max_tokens", + "max_retries", + "expected_message", + ), [ ( - { - "endpoint": "localhost:8000/v1", - "model": "model", - }, + "localhost:8000/v1", + "model", + hflow.build_ai_vlm_checks.ResponseFormat.JSON_SCHEMA, + None, + None, + 32, + 5, "absolute http", ), ( - { - "endpoint": "http://localhost:8000/v1", - "model": " ", - }, + "http://localhost:8000/v1", + " ", + hflow.build_ai_vlm_checks.ResponseFormat.JSON_SCHEMA, + None, + None, + 32, + 5, "model must not be empty", ), ( - { - "endpoint": "http://localhost:8000/v1", - "model": " model ", - }, + "http://localhost:8000/v1", + " model ", + hflow.build_ai_vlm_checks.ResponseFormat.JSON_SCHEMA, + None, + None, + 32, + 5, "model must not have leading or trailing whitespace", ), ( - { - "endpoint": "http://localhost:8000/v1", - "model": "model", - "response_format": "json", - }, + "http://localhost:8000/v1", + "model", + "json", + None, + None, + 32, + 5, "response_format must be", ), ( - { - "endpoint": "http://localhost:8000/v1", - "model": "model", - "api_key_environment_variable": "INVALID-NAME", - }, + "http://localhost:8000/v1", + "model", + hflow.build_ai_vlm_checks.ResponseFormat.JSON_SCHEMA, + "INVALID-NAME", + None, + 32, + 5, "valid environment variable name", ), ( - { - "endpoint": "http://localhost:8000/v1", - "model": "model", - "max_tokens": "32", - }, + "http://localhost:8000/v1", + "model", + hflow.build_ai_vlm_checks.ResponseFormat.JSON_SCHEMA, + None, + None, + "32", + 5, "max_tokens must be an integer", ), ( - { - "endpoint": "http://localhost:8000/v1", - "model": "model", - "max_tokens": 0, - }, - "max_tokens must be greater than zero", + "http://localhost:8000/v1", + "model", + hflow.build_ai_vlm_checks.ResponseFormat.JSON_SCHEMA, + None, + None, + True, + 5, + "max_tokens must be an integer", ), ( - { - "endpoint": "http://localhost:8000/v1", - "model": "model", - "max_retries": "5", - }, - "max_retries must be an integer", + "http://localhost:8000/v1", + "model", + hflow.build_ai_vlm_checks.ResponseFormat.JSON_SCHEMA, + None, + None, + 0, + 5, + "max_tokens must be greater than zero", ), ( - { - "endpoint": "http://localhost:8000/v1", - "model": "model", - "max_retries": -1, - }, - "max_retries must not be negative", + "http://localhost:8000/v1", + "model", + hflow.build_ai_vlm_checks.ResponseFormat.JSON_SCHEMA, + None, + None, + 32, + "5", + "max_retries must be an integer", ), ( - { - "endpoint": "http://localhost:8000/v1", - "model": "model", - "temperature": float("nan"), - }, - "temperature must be finite", + "http://localhost:8000/v1", + "model", + hflow.build_ai_vlm_checks.ResponseFormat.JSON_SCHEMA, + None, + None, + 32, + True, + "max_retries must be an integer", ), ( - { - "endpoint": "http://localhost:8000/v1", - "model": "model", - "max_tokens": True, - }, - "max_tokens must be an integer", + "http://localhost:8000/v1", + "model", + hflow.build_ai_vlm_checks.ResponseFormat.JSON_SCHEMA, + None, + None, + 32, + -1, + "max_retries must not be negative", ), ( - { - "endpoint": "http://localhost:8000/v1", - "model": "model", - "max_retries": True, - }, - "max_retries must be an integer", + "http://localhost:8000/v1", + "model", + hflow.build_ai_vlm_checks.ResponseFormat.JSON_SCHEMA, + None, + float("nan"), + 32, + 5, + "temperature must be finite", ), ], ) + def test_openai_compatible_execution_accepts_valid_configuration() -> None: execution = hflow.build_ai_vlm_checks.OpenAICompatibleExecution( endpoint="http://localhost:8000/v1", From 248463125fe04ad5116945b1eeab6e31c7567c77 Mon Sep 17 00:00:00 2001 From: msparsh13 Date: Sat, 5 Sep 2026 12:08:00 +0530 Subject: [PATCH 4/5] test: cover OpenAI compatible execution validation --- tests/test_build_ai_vlm_checks.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_build_ai_vlm_checks.py b/tests/test_build_ai_vlm_checks.py index 159284b2..1655937b 100644 --- a/tests/test_build_ai_vlm_checks.py +++ b/tests/test_build_ai_vlm_checks.py @@ -238,7 +238,6 @@ def test_build_ai_check_version_changes_with_hosted_check_version(tmp_path: Path ), ], ) - def test_openai_compatible_execution_accepts_valid_configuration() -> None: execution = hflow.build_ai_vlm_checks.OpenAICompatibleExecution( endpoint="http://localhost:8000/v1", From dd5ea87e55c7626a222a3787eb116c369c3a9125 Mon Sep 17 00:00:00 2001 From: Kingston Date: Sat, 5 Sep 2026 00:59:52 -0700 Subject: [PATCH 5/5] test(build-ai): attach the validation table to the refusal test The twelve-case parametrize decorator sat on test_openai_compatible_execution_accepts_valid_configuration, which takes no arguments, so the file did not collect at all: "function uses no argument 'endpoint'". The refusal test below it had lost its decorator and still had the old three-parameter signature. Decorator moved onto the refusal test, signature widened to the eight fields the table supplies, and the orphaned copy removed. --- tests/test_build_ai_vlm_checks.py | 34 ++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/tests/test_build_ai_vlm_checks.py b/tests/test_build_ai_vlm_checks.py index c5893af9..b7e7ec16 100644 --- a/tests/test_build_ai_vlm_checks.py +++ b/tests/test_build_ai_vlm_checks.py @@ -238,6 +238,28 @@ def test_build_ai_check_version_changes_with_hosted_check_version(tmp_path: Path ), ], ) +def test_openai_compatible_execution_refuses_invalid_configuration( + endpoint: str, + model: str, + response_format: object, + api_key_environment_variable: str | None, + temperature: float | None, + max_tokens: object, + max_retries: object, + expected_message: str, +) -> None: + with pytest.raises(ValueError, match=expected_message): + hflow.build_ai_vlm_checks.OpenAICompatibleExecution( + endpoint=endpoint, + model=model, + response_format=response_format, # ty: ignore + api_key_environment_variable=api_key_environment_variable, + temperature=temperature, + max_tokens=max_tokens, # ty: ignore + max_retries=max_retries, # ty: ignore + ) + + def test_openai_compatible_execution_accepts_valid_configuration() -> None: execution = hflow.build_ai_vlm_checks.OpenAICompatibleExecution( endpoint="http://localhost:8000/v1", @@ -258,18 +280,6 @@ def test_openai_compatible_execution_accepts_valid_configuration() -> None: assert execution.max_retries == 5 -def test_openai_compatible_execution_refuses_invalid_configuration( - endpoint: str, - model: str, - expected_message: str, -) -> None: - with pytest.raises(ValueError, match=expected_message): - hflow.build_ai_vlm_checks.OpenAICompatibleExecution( - endpoint=endpoint, - model=model, - ) - - @pytest.mark.parametrize("rejected_max_retries", [True, 2.5]) def test_openai_compatible_execution_refuses_non_integer_max_retries( rejected_max_retries: object,