superb-ai-onprem 0.9.0__py3-none-any.whl → 0.10.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of superb-ai-onprem might be problematic. Click here for more details.
- spb_onprem/__init__.py +39 -9
- spb_onprem/_version.py +2 -2
- spb_onprem/data/entities/__init__.py +2 -0
- spb_onprem/data/entities/data.py +2 -0
- spb_onprem/data/entities/data_annotation_stats.py +8 -0
- spb_onprem/data/params/data_list.py +7 -2
- spb_onprem/data/params/update_data.py +11 -0
- spb_onprem/data/params/update_data_slice.py +14 -2
- spb_onprem/data/queries.py +12 -1
- spb_onprem/data/service.py +9 -0
- spb_onprem/entities.py +24 -6
- spb_onprem/models/__init__.py +8 -3
- spb_onprem/models/entities/__init__.py +9 -0
- spb_onprem/models/entities/model.py +32 -0
- spb_onprem/models/entities/model_page_info.py +14 -0
- spb_onprem/models/entities/model_train_class.py +15 -0
- spb_onprem/models/params/__init__.py +16 -4
- spb_onprem/models/params/create_model.py +70 -0
- spb_onprem/models/params/delete_model.py +11 -8
- spb_onprem/models/params/model.py +17 -0
- spb_onprem/models/params/models.py +60 -0
- spb_onprem/models/params/pin_model.py +17 -0
- spb_onprem/models/params/unpin_model.py +17 -0
- spb_onprem/models/params/update_model.py +61 -0
- spb_onprem/models/queries.py +224 -19
- spb_onprem/models/service.py +251 -30
- spb_onprem/reports/__init__.py +25 -0
- spb_onprem/reports/entities/__init__.py +10 -0
- spb_onprem/reports/entities/analytics_report.py +22 -0
- spb_onprem/reports/entities/analytics_report_item.py +30 -0
- spb_onprem/reports/entities/analytics_report_page_info.py +14 -0
- spb_onprem/reports/params/__init__.py +29 -0
- spb_onprem/reports/params/analytics_report.py +17 -0
- spb_onprem/reports/params/analytics_reports.py +87 -0
- spb_onprem/reports/params/create_analytics_report.py +35 -0
- spb_onprem/reports/params/create_analytics_report_item.py +47 -0
- spb_onprem/reports/params/delete_analytics_report.py +17 -0
- spb_onprem/reports/params/delete_analytics_report_item.py +20 -0
- spb_onprem/reports/params/update_analytics_report.py +38 -0
- spb_onprem/reports/params/update_analytics_report_item.py +46 -0
- spb_onprem/reports/queries.py +239 -0
- spb_onprem/reports/service.py +328 -0
- spb_onprem/searches.py +18 -0
- {superb_ai_onprem-0.9.0.dist-info → superb_ai_onprem-0.10.0.dist-info}/METADATA +53 -9
- {superb_ai_onprem-0.9.0.dist-info → superb_ai_onprem-0.10.0.dist-info}/RECORD +48 -38
- spb_onprem/models/entities.py +0 -9
- spb_onprem/models/params/get_models.py +0 -29
- spb_onprem/predictions/__init__.py +0 -7
- spb_onprem/predictions/entities.py +0 -11
- spb_onprem/predictions/params/__init__.py +0 -15
- spb_onprem/predictions/params/create_prediction_set.py +0 -44
- spb_onprem/predictions/params/delete_prediction_from_data.py +0 -20
- spb_onprem/predictions/params/delete_prediction_set.py +0 -14
- spb_onprem/predictions/params/get_prediction_set.py +0 -14
- spb_onprem/predictions/params/get_prediction_sets.py +0 -29
- spb_onprem/predictions/params/update_prediction_set_data_info.py +0 -28
- spb_onprem/predictions/queries.py +0 -110
- spb_onprem/predictions/service.py +0 -225
- tests/models/__init__.py +0 -1
- tests/models/test_model_service.py +0 -249
- tests/predictions/__init__.py +0 -1
- tests/predictions/test_prediction_service.py +0 -359
- {superb_ai_onprem-0.9.0.dist-info → superb_ai_onprem-0.10.0.dist-info}/WHEEL +0 -0
- {superb_ai_onprem-0.9.0.dist-info → superb_ai_onprem-0.10.0.dist-info}/licenses/LICENSE +0 -0
- {superb_ai_onprem-0.9.0.dist-info → superb_ai_onprem-0.10.0.dist-info}/top_level.txt +0 -0
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
from typing import Optional, Dict, Any, List, Tuple, Union
|
|
2
|
-
|
|
3
|
-
from spb_onprem.base_service import BaseService
|
|
4
|
-
from spb_onprem.base_types import Undefined, UndefinedType
|
|
5
|
-
from spb_onprem.exceptions import BadParameterError
|
|
6
|
-
from .queries import Queries
|
|
7
|
-
from .entities import PredictionSet
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class PredictionService(BaseService):
|
|
11
|
-
"""Service class for handling prediction set operations."""
|
|
12
|
-
|
|
13
|
-
def get_prediction_sets(
|
|
14
|
-
self,
|
|
15
|
-
dataset_id: str,
|
|
16
|
-
filter: Union[UndefinedType, Dict[str, Any]] = Undefined,
|
|
17
|
-
cursor: Union[UndefinedType, str] = Undefined,
|
|
18
|
-
length: int = 50
|
|
19
|
-
) -> Tuple[List[PredictionSet], Optional[str], int]:
|
|
20
|
-
"""Get paginated list of prediction sets for a dataset.
|
|
21
|
-
|
|
22
|
-
Args:
|
|
23
|
-
dataset_id (str): The dataset ID.
|
|
24
|
-
filter (Union[UndefinedType, Dict[str, Any]]): Filter for prediction sets.
|
|
25
|
-
cursor (Union[UndefinedType, str]): Cursor for pagination.
|
|
26
|
-
length (int): Number of items to retrieve per page.
|
|
27
|
-
|
|
28
|
-
Returns:
|
|
29
|
-
Tuple[List[PredictionSet], Optional[str], int]: A tuple containing prediction sets, next cursor, and total count.
|
|
30
|
-
"""
|
|
31
|
-
if dataset_id is None:
|
|
32
|
-
raise BadParameterError("dataset_id is required.")
|
|
33
|
-
|
|
34
|
-
response = self.request_gql(
|
|
35
|
-
Queries.GET_PREDICTION_SETS,
|
|
36
|
-
Queries.GET_PREDICTION_SETS["variables"](
|
|
37
|
-
dataset_id=dataset_id,
|
|
38
|
-
filter=filter,
|
|
39
|
-
cursor=cursor,
|
|
40
|
-
length=length
|
|
41
|
-
)
|
|
42
|
-
)
|
|
43
|
-
prediction_sets_list = response.get("predictionSets", [])
|
|
44
|
-
return (
|
|
45
|
-
[PredictionSet.model_validate(ps) for ps in prediction_sets_list],
|
|
46
|
-
response.get("next"),
|
|
47
|
-
response.get("totalCount", 0)
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
def get_prediction_set(
|
|
51
|
-
self,
|
|
52
|
-
dataset_id: str,
|
|
53
|
-
prediction_set_id: str
|
|
54
|
-
) -> PredictionSet:
|
|
55
|
-
"""Get detailed prediction set information including content IDs.
|
|
56
|
-
|
|
57
|
-
Args:
|
|
58
|
-
dataset_id (str): The dataset ID.
|
|
59
|
-
prediction_set_id (str): The prediction set ID.
|
|
60
|
-
|
|
61
|
-
Returns:
|
|
62
|
-
PredictionSet: The prediction set entity.
|
|
63
|
-
"""
|
|
64
|
-
if dataset_id is None:
|
|
65
|
-
raise BadParameterError("dataset_id is required.")
|
|
66
|
-
if prediction_set_id is None:
|
|
67
|
-
raise BadParameterError("prediction_set_id is required.")
|
|
68
|
-
|
|
69
|
-
response = self.request_gql(
|
|
70
|
-
Queries.GET_PREDICTION_SET,
|
|
71
|
-
Queries.GET_PREDICTION_SET["variables"](
|
|
72
|
-
dataset_id=dataset_id,
|
|
73
|
-
prediction_set_id=prediction_set_id
|
|
74
|
-
)
|
|
75
|
-
)
|
|
76
|
-
prediction_set_dict = response.get("predictionSet", {})
|
|
77
|
-
return PredictionSet.model_validate(prediction_set_dict)
|
|
78
|
-
|
|
79
|
-
def delete_prediction_set(
|
|
80
|
-
self,
|
|
81
|
-
dataset_id: str,
|
|
82
|
-
prediction_set_id: str
|
|
83
|
-
) -> bool:
|
|
84
|
-
"""Delete a prediction set from the dataset.
|
|
85
|
-
|
|
86
|
-
Args:
|
|
87
|
-
dataset_id (str): The dataset ID.
|
|
88
|
-
prediction_set_id (str): The prediction set ID to delete.
|
|
89
|
-
|
|
90
|
-
Returns:
|
|
91
|
-
bool: True if deletion was successful.
|
|
92
|
-
"""
|
|
93
|
-
if dataset_id is None:
|
|
94
|
-
raise BadParameterError("dataset_id is required.")
|
|
95
|
-
if prediction_set_id is None:
|
|
96
|
-
raise BadParameterError("prediction_set_id is required.")
|
|
97
|
-
|
|
98
|
-
response = self.request_gql(
|
|
99
|
-
Queries.DELETE_PREDICTION_SET,
|
|
100
|
-
Queries.DELETE_PREDICTION_SET["variables"](
|
|
101
|
-
dataset_id=dataset_id,
|
|
102
|
-
prediction_set_id=prediction_set_id
|
|
103
|
-
)
|
|
104
|
-
)
|
|
105
|
-
return response
|
|
106
|
-
|
|
107
|
-
def delete_prediction_from_data(
|
|
108
|
-
self,
|
|
109
|
-
dataset_id: str,
|
|
110
|
-
data_id: str,
|
|
111
|
-
prediction_set_id: str
|
|
112
|
-
) -> bool:
|
|
113
|
-
"""Delete predictions from a specific data item for a given prediction set.
|
|
114
|
-
|
|
115
|
-
Args:
|
|
116
|
-
dataset_id (str): The dataset ID.
|
|
117
|
-
data_id (str): The data ID.
|
|
118
|
-
prediction_set_id (str): The prediction set ID.
|
|
119
|
-
|
|
120
|
-
Returns:
|
|
121
|
-
bool: True if deletion was successful.
|
|
122
|
-
"""
|
|
123
|
-
if dataset_id is None:
|
|
124
|
-
raise BadParameterError("dataset_id is required.")
|
|
125
|
-
if data_id is None:
|
|
126
|
-
raise BadParameterError("data_id is required.")
|
|
127
|
-
if prediction_set_id is None:
|
|
128
|
-
raise BadParameterError("prediction_set_id is required.")
|
|
129
|
-
|
|
130
|
-
response = self.request_gql(
|
|
131
|
-
Queries.DELETE_PREDICTION_FROM_DATA,
|
|
132
|
-
Queries.DELETE_PREDICTION_FROM_DATA["variables"](
|
|
133
|
-
dataset_id=dataset_id,
|
|
134
|
-
data_id=data_id,
|
|
135
|
-
prediction_set_id=prediction_set_id
|
|
136
|
-
)
|
|
137
|
-
)
|
|
138
|
-
return response.get("deletePrediction") is not None
|
|
139
|
-
|
|
140
|
-
def create_prediction_set(
|
|
141
|
-
self,
|
|
142
|
-
dataset_id: str,
|
|
143
|
-
model_id: str,
|
|
144
|
-
name: str,
|
|
145
|
-
type: str,
|
|
146
|
-
description: Optional[str] = None,
|
|
147
|
-
annotations_count: Optional[int] = None,
|
|
148
|
-
data_count: Optional[int] = None,
|
|
149
|
-
) -> Optional[str]:
|
|
150
|
-
"""Create a new prediction set.
|
|
151
|
-
|
|
152
|
-
Args:
|
|
153
|
-
dataset_id (str): The dataset ID.
|
|
154
|
-
model_id (str): The model ID.
|
|
155
|
-
name (str): Name of the prediction set.
|
|
156
|
-
type (str): Type of the prediction set.
|
|
157
|
-
description (Optional[str]): Description of the prediction set.
|
|
158
|
-
annotations_count (Optional[int]): Number of annotations.
|
|
159
|
-
data_count (Optional[int]): Number of data items.
|
|
160
|
-
|
|
161
|
-
Returns:
|
|
162
|
-
Optional[str]: The created prediction set ID if successful, None otherwise.
|
|
163
|
-
"""
|
|
164
|
-
if dataset_id is None:
|
|
165
|
-
raise BadParameterError("dataset_id is required.")
|
|
166
|
-
if model_id is None:
|
|
167
|
-
raise BadParameterError("model_id is required.")
|
|
168
|
-
if name is None:
|
|
169
|
-
raise BadParameterError("name is required.")
|
|
170
|
-
if type is None:
|
|
171
|
-
raise BadParameterError("type is required.")
|
|
172
|
-
|
|
173
|
-
response = self.request_gql(
|
|
174
|
-
Queries.CREATE_PREDICTION_SET,
|
|
175
|
-
Queries.CREATE_PREDICTION_SET["variables"](
|
|
176
|
-
dataset_id=dataset_id,
|
|
177
|
-
model_id=model_id,
|
|
178
|
-
name=name,
|
|
179
|
-
type=type,
|
|
180
|
-
description=description,
|
|
181
|
-
annotations_count=annotations_count,
|
|
182
|
-
data_count=data_count
|
|
183
|
-
)
|
|
184
|
-
)
|
|
185
|
-
prediction_set = response.get("createPredictionSet")
|
|
186
|
-
return prediction_set.get("id") if prediction_set else None
|
|
187
|
-
|
|
188
|
-
def update_prediction_set_data_info(
|
|
189
|
-
self,
|
|
190
|
-
dataset_id: str,
|
|
191
|
-
id: str,
|
|
192
|
-
annotation_count: int,
|
|
193
|
-
data_count: int
|
|
194
|
-
) -> Optional[str]:
|
|
195
|
-
"""Update the data info of a prediction set.
|
|
196
|
-
|
|
197
|
-
Args:
|
|
198
|
-
dataset_id (str): The dataset ID.
|
|
199
|
-
id (str): The prediction set ID to update.
|
|
200
|
-
annotation_count (int): Number of annotations.
|
|
201
|
-
data_count (int): Number of data items.
|
|
202
|
-
|
|
203
|
-
Returns:
|
|
204
|
-
Optional[str]: The updated prediction set ID if successful, None otherwise.
|
|
205
|
-
"""
|
|
206
|
-
if dataset_id is None:
|
|
207
|
-
raise BadParameterError("dataset_id is required.")
|
|
208
|
-
if id is None:
|
|
209
|
-
raise BadParameterError("id is required.")
|
|
210
|
-
if annotation_count is None:
|
|
211
|
-
raise BadParameterError("annotation_count is required.")
|
|
212
|
-
if data_count is None:
|
|
213
|
-
raise BadParameterError("data_count is required.")
|
|
214
|
-
|
|
215
|
-
response = self.request_gql(
|
|
216
|
-
Queries.UPDATE_PREDICTION_SET_DATA_INFO,
|
|
217
|
-
Queries.UPDATE_PREDICTION_SET_DATA_INFO["variables"](
|
|
218
|
-
dataset_id=dataset_id,
|
|
219
|
-
id=id,
|
|
220
|
-
annotation_count=annotation_count,
|
|
221
|
-
data_count=data_count
|
|
222
|
-
)
|
|
223
|
-
)
|
|
224
|
-
prediction_set = response.get("updatePredictionSet")
|
|
225
|
-
return prediction_set.get("id") if prediction_set else None
|
tests/models/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Models test package
|
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
import pytest
|
|
2
|
-
from unittest.mock import Mock
|
|
3
|
-
|
|
4
|
-
from spb_onprem.models.service import ModelService
|
|
5
|
-
from spb_onprem.models.queries import Queries
|
|
6
|
-
from spb_onprem.exceptions import BadParameterError
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class TestModelService:
|
|
10
|
-
"""Test cases for ModelService methods."""
|
|
11
|
-
|
|
12
|
-
def setup_method(self):
|
|
13
|
-
"""Set up test fixtures before each test method."""
|
|
14
|
-
self.model_service = ModelService()
|
|
15
|
-
self.model_service.request_gql = Mock()
|
|
16
|
-
|
|
17
|
-
def test_get_models_success(self):
|
|
18
|
-
"""Test successful models list retrieval."""
|
|
19
|
-
# Arrange
|
|
20
|
-
dataset_id = "dataset-123"
|
|
21
|
-
filter_dict = {"name": "test"}
|
|
22
|
-
cursor = "cursor-abc"
|
|
23
|
-
length = 25
|
|
24
|
-
|
|
25
|
-
mock_response = {
|
|
26
|
-
"models": [
|
|
27
|
-
{"id": "model-1", "name": "Model 1"},
|
|
28
|
-
{"id": "model-2", "name": "Model 2"}
|
|
29
|
-
],
|
|
30
|
-
"next": "cursor-def",
|
|
31
|
-
"totalCount": 50
|
|
32
|
-
}
|
|
33
|
-
self.model_service.request_gql.return_value = mock_response
|
|
34
|
-
|
|
35
|
-
# Act
|
|
36
|
-
result = self.model_service.get_models(
|
|
37
|
-
dataset_id=dataset_id,
|
|
38
|
-
filter=filter_dict,
|
|
39
|
-
cursor=cursor,
|
|
40
|
-
length=length
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
# Assert
|
|
44
|
-
models, next_cursor, total_count = result
|
|
45
|
-
assert len(models) == 2
|
|
46
|
-
assert models[0].id == "model-1"
|
|
47
|
-
assert models[0].name == "Model 1"
|
|
48
|
-
assert models[1].id == "model-2"
|
|
49
|
-
assert models[1].name == "Model 2"
|
|
50
|
-
assert next_cursor == "cursor-def"
|
|
51
|
-
assert total_count == 50
|
|
52
|
-
self.model_service.request_gql.assert_called_once_with(
|
|
53
|
-
Queries.GET_MODELS,
|
|
54
|
-
Queries.GET_MODELS["variables"](
|
|
55
|
-
dataset_id=dataset_id,
|
|
56
|
-
filter=filter_dict,
|
|
57
|
-
cursor=cursor,
|
|
58
|
-
length=length
|
|
59
|
-
)
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
def test_get_models_without_filter(self):
|
|
63
|
-
"""Test models retrieval without filter."""
|
|
64
|
-
# Arrange
|
|
65
|
-
dataset_id = "dataset-123"
|
|
66
|
-
|
|
67
|
-
mock_response = {
|
|
68
|
-
"models": [{"id": "model-1", "name": "Test Model"}],
|
|
69
|
-
"next": None,
|
|
70
|
-
"totalCount": 1
|
|
71
|
-
}
|
|
72
|
-
self.model_service.request_gql.return_value = mock_response
|
|
73
|
-
|
|
74
|
-
# Act
|
|
75
|
-
result = self.model_service.get_models(dataset_id=dataset_id)
|
|
76
|
-
|
|
77
|
-
# Assert
|
|
78
|
-
models, next_cursor, total_count = result
|
|
79
|
-
assert total_count == 1
|
|
80
|
-
assert next_cursor is None
|
|
81
|
-
assert len(models) == 1
|
|
82
|
-
assert models[0].name == "Test Model"
|
|
83
|
-
|
|
84
|
-
def test_get_models_with_pagination(self):
|
|
85
|
-
"""Test models retrieval with pagination parameters."""
|
|
86
|
-
# Arrange
|
|
87
|
-
dataset_id = "dataset-123"
|
|
88
|
-
cursor = "pagination-cursor"
|
|
89
|
-
length = 10
|
|
90
|
-
|
|
91
|
-
mock_response = {
|
|
92
|
-
"models": [
|
|
93
|
-
{"id": "model-3", "name": "Model 3"},
|
|
94
|
-
{"id": "model-4", "name": "Model 4"}
|
|
95
|
-
],
|
|
96
|
-
"next": "next-cursor",
|
|
97
|
-
"totalCount": 20
|
|
98
|
-
}
|
|
99
|
-
self.model_service.request_gql.return_value = mock_response
|
|
100
|
-
|
|
101
|
-
# Act
|
|
102
|
-
result = self.model_service.get_models(
|
|
103
|
-
dataset_id=dataset_id,
|
|
104
|
-
cursor=cursor,
|
|
105
|
-
length=length
|
|
106
|
-
)
|
|
107
|
-
|
|
108
|
-
# Assert
|
|
109
|
-
models, next_cursor, total_count = result
|
|
110
|
-
assert next_cursor == "next-cursor"
|
|
111
|
-
assert total_count == 20
|
|
112
|
-
assert len(models) == 2
|
|
113
|
-
|
|
114
|
-
def test_get_models_missing_dataset_id(self):
|
|
115
|
-
"""Test models with missing dataset_id."""
|
|
116
|
-
# Act & Assert
|
|
117
|
-
with pytest.raises(BadParameterError, match="dataset_id is required"):
|
|
118
|
-
self.model_service.get_models(dataset_id=None)
|
|
119
|
-
|
|
120
|
-
def test_get_models_empty_response(self):
|
|
121
|
-
"""Test models with empty response."""
|
|
122
|
-
# Arrange
|
|
123
|
-
dataset_id = "dataset-123"
|
|
124
|
-
mock_response = {}
|
|
125
|
-
self.model_service.request_gql.return_value = mock_response
|
|
126
|
-
|
|
127
|
-
# Act
|
|
128
|
-
result = self.model_service.get_models(dataset_id=dataset_id)
|
|
129
|
-
|
|
130
|
-
# Assert
|
|
131
|
-
models, next_cursor, total_count = result
|
|
132
|
-
assert len(models) == 0
|
|
133
|
-
assert next_cursor is None
|
|
134
|
-
assert total_count == 0
|
|
135
|
-
|
|
136
|
-
def test_get_models_zero_results(self):
|
|
137
|
-
"""Test models retrieval with zero results."""
|
|
138
|
-
# Arrange
|
|
139
|
-
dataset_id = "empty-dataset"
|
|
140
|
-
|
|
141
|
-
mock_response = {
|
|
142
|
-
"models": [],
|
|
143
|
-
"next": None,
|
|
144
|
-
"totalCount": 0
|
|
145
|
-
}
|
|
146
|
-
self.model_service.request_gql.return_value = mock_response
|
|
147
|
-
|
|
148
|
-
# Act
|
|
149
|
-
result = self.model_service.get_models(dataset_id=dataset_id)
|
|
150
|
-
|
|
151
|
-
# Assert
|
|
152
|
-
models, next_cursor, total_count = result
|
|
153
|
-
assert total_count == 0
|
|
154
|
-
assert next_cursor is None
|
|
155
|
-
assert len(models) == 0
|
|
156
|
-
|
|
157
|
-
def test_delete_model_success(self):
|
|
158
|
-
"""Test successful model deletion."""
|
|
159
|
-
# Arrange
|
|
160
|
-
dataset_id = "dataset-123"
|
|
161
|
-
model_id = "model-456"
|
|
162
|
-
|
|
163
|
-
mock_response = True
|
|
164
|
-
self.model_service.request_gql.return_value = mock_response
|
|
165
|
-
|
|
166
|
-
# Act
|
|
167
|
-
result = self.model_service.delete_model(
|
|
168
|
-
dataset_id=dataset_id,
|
|
169
|
-
model_id=model_id
|
|
170
|
-
)
|
|
171
|
-
|
|
172
|
-
# Assert
|
|
173
|
-
assert result is True
|
|
174
|
-
self.model_service.request_gql.assert_called_once_with(
|
|
175
|
-
Queries.DELETE_MODEL,
|
|
176
|
-
Queries.DELETE_MODEL["variables"](
|
|
177
|
-
dataset_id=dataset_id,
|
|
178
|
-
model_id=model_id
|
|
179
|
-
)
|
|
180
|
-
)
|
|
181
|
-
|
|
182
|
-
def test_delete_model_failure(self):
|
|
183
|
-
"""Test model deletion failure."""
|
|
184
|
-
# Arrange
|
|
185
|
-
dataset_id = "dataset-123"
|
|
186
|
-
model_id = "nonexistent-model"
|
|
187
|
-
|
|
188
|
-
mock_response = False
|
|
189
|
-
self.model_service.request_gql.return_value = mock_response
|
|
190
|
-
|
|
191
|
-
# Act
|
|
192
|
-
result = self.model_service.delete_model(
|
|
193
|
-
dataset_id=dataset_id,
|
|
194
|
-
model_id=model_id
|
|
195
|
-
)
|
|
196
|
-
|
|
197
|
-
# Assert
|
|
198
|
-
assert result is False
|
|
199
|
-
|
|
200
|
-
def test_delete_model_missing_response(self):
|
|
201
|
-
"""Test model deletion with missing response field."""
|
|
202
|
-
# Arrange
|
|
203
|
-
dataset_id = "dataset-123"
|
|
204
|
-
model_id = "model-456"
|
|
205
|
-
|
|
206
|
-
mock_response = False
|
|
207
|
-
self.model_service.request_gql.return_value = mock_response
|
|
208
|
-
|
|
209
|
-
# Act
|
|
210
|
-
result = self.model_service.delete_model(
|
|
211
|
-
dataset_id=dataset_id,
|
|
212
|
-
model_id=model_id
|
|
213
|
-
)
|
|
214
|
-
|
|
215
|
-
# Assert
|
|
216
|
-
assert result is False
|
|
217
|
-
|
|
218
|
-
def test_delete_model_missing_dataset_id(self):
|
|
219
|
-
"""Test delete model with missing dataset_id."""
|
|
220
|
-
# Arrange
|
|
221
|
-
model_id = "model-456"
|
|
222
|
-
|
|
223
|
-
# Act & Assert
|
|
224
|
-
with pytest.raises(BadParameterError, match="dataset_id is required"):
|
|
225
|
-
self.model_service.delete_model(
|
|
226
|
-
dataset_id=None,
|
|
227
|
-
model_id=model_id
|
|
228
|
-
)
|
|
229
|
-
|
|
230
|
-
def test_delete_model_missing_model_id(self):
|
|
231
|
-
"""Test delete model with missing model_id."""
|
|
232
|
-
# Arrange
|
|
233
|
-
dataset_id = "dataset-123"
|
|
234
|
-
|
|
235
|
-
# Act & Assert
|
|
236
|
-
with pytest.raises(BadParameterError, match="model_id is required"):
|
|
237
|
-
self.model_service.delete_model(
|
|
238
|
-
dataset_id=dataset_id,
|
|
239
|
-
model_id=None
|
|
240
|
-
)
|
|
241
|
-
|
|
242
|
-
def test_delete_model_both_missing_params(self):
|
|
243
|
-
"""Test delete model with both missing parameters."""
|
|
244
|
-
# Act & Assert
|
|
245
|
-
with pytest.raises(BadParameterError, match="dataset_id is required"):
|
|
246
|
-
self.model_service.delete_model(
|
|
247
|
-
dataset_id=None,
|
|
248
|
-
model_id=None
|
|
249
|
-
)
|
tests/predictions/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Predictions test package
|