Add a handler to make the structure of validation errors consistent.

This commit is contained in:
2025-11-16 12:26:47 +02:00
parent 763773ee51
commit 59caa6a0ab
3 changed files with 34 additions and 3 deletions
+2 -2
View File
@@ -89,7 +89,7 @@ class TestGeneralEndpoint:
"entities": []
}
response = api_client.post(f"{BASE_URL}/general", json=payload)
assert response.status_code == 422 # Pydantic validation error
assert response.status_code == 400
def test_error_empty_texts_list(self, api_client):
"""Test error with an empty texts list"""
@@ -109,7 +109,7 @@ class TestGeneralEndpoint:
"threshold": threshold
}
response = api_client.post(f"{BASE_URL}/general", json=payload)
assert response.status_code == 422
assert response.status_code == 400
@pytest.mark.parametrize("threshold", [0.0, 0.5, 1.0])
def test_valid_threshold_range(self, api_client, threshold):
+1 -1
View File
@@ -73,7 +73,7 @@ class TestRelationExtractionEndpoint:
"relations": []
}
response = api_client.post(f"{BASE_URL}/relation-extraction", json=payload)
assert response.status_code == 422
assert response.status_code == 400
def test_error_both_text_and_texts(self, api_client):
"""Test error when both text and texts are present"""