fiddler-client 2.3.0.dev2__py3-none-any.whl → 2.4.0.dev1__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.
- fiddler/__init__.py +2 -0
- fiddler/_version.py +1 -1
- fiddler/api/alert_mixin.py +1 -1
- fiddler/api/api.py +2 -0
- fiddler/api/webhooks_mixin.py +9 -7
- fiddler/core_objects.py +98 -47
- fiddler/schemas/custom_features.py +25 -19
- fiddler3/constants/baseline.py +19 -0
- fiddler3/constants/common.py +12 -0
- fiddler3/constants/dataset.py +7 -0
- fiddler3/constants/model_deployment.py +15 -0
- fiddler3/constants/xai.py +11 -0
- fiddler3/entities/__init__.py +5 -1
- fiddler3/entities/base.py +22 -18
- fiddler3/entities/baseline.py +228 -0
- fiddler3/entities/dataset.py +149 -0
- fiddler3/entities/job.py +9 -8
- fiddler3/entities/model.py +160 -29
- fiddler3/entities/model_artifact.py +350 -0
- fiddler3/entities/model_deployment.py +112 -0
- fiddler3/entities/model_surrogate.py +92 -0
- fiddler3/entities/organization.py +38 -0
- fiddler3/entities/project.py +69 -8
- fiddler3/entities/user.py +45 -0
- fiddler3/entities/xai.py +309 -0
- fiddler3/libs/http_client.py +24 -13
- fiddler3/libs/json_encoder.py +12 -0
- fiddler3/schemas/__init__.py +4 -0
- fiddler3/schemas/baseline.py +37 -0
- fiddler3/schemas/custom_features.py +23 -18
- fiddler3/schemas/dataset.py +27 -0
- fiddler3/schemas/deployment_params.py +25 -0
- fiddler3/schemas/filter_query.py +54 -0
- fiddler3/schemas/job.py +2 -2
- fiddler3/schemas/model.py +9 -9
- fiddler3/schemas/model_artifact.py +6 -0
- fiddler3/schemas/model_deployment.py +26 -0
- fiddler3/schemas/organization.py +9 -1
- fiddler3/schemas/project.py +4 -4
- fiddler3/schemas/server_info.py +2 -2
- fiddler3/schemas/user.py +1 -1
- fiddler3/schemas/xai.py +32 -0
- fiddler3/tests/apis/test_baseline.py +292 -0
- fiddler3/tests/apis/test_dataset.py +173 -0
- fiddler3/tests/apis/test_mixin.py +77 -0
- fiddler3/tests/apis/test_model.py +102 -7
- fiddler3/tests/apis/test_model_artifact.py +175 -0
- fiddler3/tests/apis/test_model_deployment.py +98 -0
- fiddler3/tests/apis/test_model_surrogate.py +159 -0
- fiddler3/tests/apis/test_project.py +36 -20
- fiddler3/tests/apis/test_xai.py +690 -0
- fiddler3/tests/constants.py +10 -0
- fiddler3/tests/test_json_encoder.py +16 -0
- fiddler3/tests/test_logger.py +12 -0
- fiddler3/tests/test_utils.py +19 -0
- fiddler3/utils/__init__.py +1 -0
- fiddler3/utils/helpers.py +43 -0
- fiddler3/utils/logger.py +15 -0
- fiddler3/utils/validations.py +11 -0
- {fiddler_client-2.3.0.dev2.dist-info → fiddler_client-2.4.0.dev1.dist-info}/METADATA +7 -5
- {fiddler_client-2.3.0.dev2.dist-info → fiddler_client-2.4.0.dev1.dist-info}/RECORD +65 -33
- tests/fiddler/test_segments.py +227 -0
- {fiddler_client-2.3.0.dev2.dist-info → fiddler_client-2.4.0.dev1.dist-info}/LICENSE.txt +0 -0
- {fiddler_client-2.3.0.dev2.dist-info → fiddler_client-2.4.0.dev1.dist-info}/WHEEL +0 -0
- {fiddler_client-2.3.0.dev2.dist-info → fiddler_client-2.4.0.dev1.dist-info}/top_level.txt +0 -0
|
@@ -5,6 +5,7 @@ from uuid import UUID
|
|
|
5
5
|
|
|
6
6
|
import pytest
|
|
7
7
|
import responses
|
|
8
|
+
from pytest_mock import MockerFixture
|
|
8
9
|
from responses import matchers
|
|
9
10
|
|
|
10
11
|
from fiddler3.entities.project import Project
|
|
@@ -143,7 +144,9 @@ def test_get_project_not_found() -> None:
|
|
|
143
144
|
|
|
144
145
|
@responses.activate
|
|
145
146
|
def test_project_from_name_success() -> None:
|
|
146
|
-
params = {
|
|
147
|
+
params = {
|
|
148
|
+
'filter': '{"condition": "AND", "rules": [{"field": "name", "operator": "equal", "value": "bank_churn"}]}'
|
|
149
|
+
}
|
|
147
150
|
responses.get(
|
|
148
151
|
url=f'{URL}/v3/projects',
|
|
149
152
|
json=API_RESPONSE_FROM_NAME,
|
|
@@ -154,45 +157,47 @@ def test_project_from_name_success() -> None:
|
|
|
154
157
|
|
|
155
158
|
|
|
156
159
|
@responses.activate
|
|
157
|
-
def
|
|
158
|
-
responses.get(
|
|
159
|
-
url=f'{URL}/v3/projects',
|
|
160
|
-
json=LIST_API_RESPONSE,
|
|
161
|
-
)
|
|
162
|
-
for project in Project.list():
|
|
163
|
-
assert isinstance(project, Project)
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
@responses.activate
|
|
167
|
-
def test_project_list_empty() -> None:
|
|
160
|
+
def test_project_from_name_not_found() -> None:
|
|
168
161
|
resp = API_RESPONSE_FROM_NAME.copy()
|
|
169
162
|
resp['data']['total'] = 0
|
|
170
163
|
resp['data']['item_count'] = 0
|
|
171
164
|
resp['data']['items'] = []
|
|
172
165
|
|
|
166
|
+
params = {
|
|
167
|
+
'filter': '{"condition": "AND", "rules": [{"field": "name", "operator": "equal", "value": "bank_churn"}]}'
|
|
168
|
+
}
|
|
173
169
|
responses.get(
|
|
174
170
|
url=f'{URL}/v3/projects',
|
|
175
171
|
json=resp,
|
|
172
|
+
match=[matchers.query_param_matcher(params)],
|
|
176
173
|
)
|
|
177
|
-
|
|
174
|
+
|
|
175
|
+
with pytest.raises(NotFound):
|
|
176
|
+
Project.from_name(name=PROJECT_NAME)
|
|
178
177
|
|
|
179
178
|
|
|
180
179
|
@responses.activate
|
|
181
|
-
def
|
|
180
|
+
def test_project_list_success() -> None:
|
|
181
|
+
responses.get(
|
|
182
|
+
url=f'{URL}/v3/projects',
|
|
183
|
+
json=LIST_API_RESPONSE,
|
|
184
|
+
)
|
|
185
|
+
for project in Project.list():
|
|
186
|
+
assert isinstance(project, Project)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
@responses.activate
|
|
190
|
+
def test_project_list_empty() -> None:
|
|
182
191
|
resp = API_RESPONSE_FROM_NAME.copy()
|
|
183
192
|
resp['data']['total'] = 0
|
|
184
193
|
resp['data']['item_count'] = 0
|
|
185
194
|
resp['data']['items'] = []
|
|
186
195
|
|
|
187
|
-
params = {'name': PROJECT_NAME}
|
|
188
196
|
responses.get(
|
|
189
197
|
url=f'{URL}/v3/projects',
|
|
190
198
|
json=resp,
|
|
191
|
-
match=[matchers.query_param_matcher(params)],
|
|
192
199
|
)
|
|
193
|
-
|
|
194
|
-
with pytest.raises(NotFound):
|
|
195
|
-
Project.from_name(name=PROJECT_NAME)
|
|
200
|
+
assert len(list(Project.list())) == 0
|
|
196
201
|
|
|
197
202
|
|
|
198
203
|
@responses.activate
|
|
@@ -215,7 +220,18 @@ def test_delete_project_not_found() -> None:
|
|
|
215
220
|
status=HTTPStatus.NOT_FOUND,
|
|
216
221
|
)
|
|
217
222
|
project = Project(name=PROJECT_NAME)
|
|
218
|
-
project.id = PROJECT_ID
|
|
223
|
+
project.id = UUID(PROJECT_ID)
|
|
219
224
|
|
|
220
225
|
with pytest.raises(NotFound):
|
|
221
226
|
project.delete()
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
def test_models_property(mocker: MockerFixture) -> None:
|
|
230
|
+
mock_fn = mocker.patch('fiddler3.entities.Model.list')
|
|
231
|
+
|
|
232
|
+
project = Project(name=PROJECT_NAME)
|
|
233
|
+
project.id = UUID(PROJECT_ID)
|
|
234
|
+
|
|
235
|
+
_ = list(project.models)
|
|
236
|
+
|
|
237
|
+
mock_fn.assert_called_with(project_id=project.id)
|