Add a handler to make the structure of validation errors consistent.
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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"""
|
||||
|
||||
Reference in New Issue
Block a user