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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user