From 81c7bfff846c62e24370b7ce583749c43b64d322 Mon Sep 17 00:00:00 2001 From: co tran Date: Tue, 1 Apr 2025 01:18:28 +0000 Subject: [PATCH] fix test --- tests/modelserver/test_hallucination.py | 34 ++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/modelserver/test_hallucination.py b/tests/modelserver/test_hallucination.py index 74c42561..323db3fc 100644 --- a/tests/modelserver/test_hallucination.py +++ b/tests/modelserver/test_hallucination.py @@ -23,22 +23,22 @@ with open(yaml_file_path, "r") as file: test_data_yaml = yaml.safe_load(file) -# @pytest.mark.parametrize( -# "test_data", -# [ -# pytest.param(test_case, id=test_case["id"]) -# for test_case in test_data_yaml["test_cases"] -# ], -# ) -# def test_model_server(test_data): -# input = test_data["input"] -# expected = test_data["expected"] +@pytest.mark.parametrize( + "test_data", + [ + pytest.param(test_case, id=test_case["id"]) + for test_case in test_data_yaml["test_cases"] + ], +) +def test_model_server(test_data): + input = test_data["input"] + expected = test_data["expected"] -# response = requests.post(MODEL_SERVER_ENDPOINT, json=input) -# assert response.status_code == 200 -# assert response.headers["content-type"] == "application/json" + response = requests.post(MODEL_SERVER_ENDPOINT, json=input) + assert response.status_code == 200 + assert response.headers["content-type"] == "application/json" -# response_json = response.json() -# assert response_json -# metadata = response_json.get("metadata", {}) -# assert (metadata["hallucination"].lower() == "true") == expected[0]["hallucination"] + response_json = response.json() + assert response_json + metadata = response_json.get("metadata", {}) + assert (metadata["hallucination"].lower() == "true") == expected[0]["hallucination"]