-
-
Notifications
You must be signed in to change notification settings - Fork 271
Expand file tree
/
Copy pathtest_evaluation.py
More file actions
39 lines (30 loc) · 1.08 KB
/
test_evaluation.py
File metadata and controls
39 lines (30 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# License: BSD 3-Clause
from __future__ import annotations
import pytest
from openml._api import EvaluationV1API, EvaluationV2API
from openml.evaluations import OpenMLEvaluation
from openml.exceptions import OpenMLNotSupportedError
@pytest.fixture
def evaluation_v1(http_client_v1, minio_client) -> EvaluationV1API:
return EvaluationV1API(http=http_client_v1, minio=minio_client)
@pytest.fixture
def evaluation_v2(http_client_v2, minio_client) -> EvaluationV2API:
return EvaluationV2API(http=http_client_v2, minio=minio_client)
@pytest.mark.test_server()
def test_v1_list(evaluation_v1):
evaluations = evaluation_v1.list(
function="predictive_accuracy",
limit=10,
offset=0,
)
assert isinstance(evaluations, list)
assert len(evaluations) == 10
assert all(isinstance(e, OpenMLEvaluation) for e in evaluations)
@pytest.mark.test_server()
def test_v2_list(evaluation_v2):
with pytest.raises(OpenMLNotSupportedError):
evaluation_v2.list(
function="predictive_accuracy",
limit=10,
offset=0,
)