SIENTIAPDE-1182

Refactor test data structure in gates.py and model_repository.py for improved clarity and consistency

- Updated test cases in test_gates.py to use dictionaries for prediction and response_time, associating values with timestamps.
- Modified test_predict_success in test_model_repository.py to create a DataFrame with named indices for better readability in assertions.
This commit is contained in:
vitor-aignosi
2025-09-04 12:16:14 -03:00
parent 2e420dadba
commit 8ab1b9b437
2 changed files with 47 additions and 13 deletions

View File

@@ -59,7 +59,12 @@ def test_transform_error(mlflow_repository):
def test_predict_success(mlflow_repository):
data = 'data'
data = DataFrame({
'feat_1': {
'index_1': 2,
'index_2': 3
}
})
model_name = 'model'
mlflow_repository.model_serving.get_cached_predict.return_value = np.array(
[2, 3]
@@ -71,10 +76,15 @@ def test_predict_success(mlflow_repository):
model_name, data, 1)
assert output['success'] is True
assert output['content'] == {'prediction': {
0: 2,
1: 3
}, 'response_time': ANY}
assert output['content'] == {
'prediction': {
'index_1': 2,
'index_2': 3
}, 'response_time': {
'index_1': ANY,
'index_2': ANY
}
}
def test_predict_error(mlflow_repository):