55from openml ._api .resources .evaluation import EvaluationV1API , EvaluationV2API
66from openml .evaluations import OpenMLEvaluation
77from openml .testing import TestAPIBase
8- from openml ._api . resources . base . fallback import FallbackProxy
9-
8+ from openml .enums import APIVersion
9+ from openml . exceptions import OpenMLNotSupportedError
1010
1111class TestEvaluationV1 (TestAPIBase ):
1212 """Tests for V1 XML API implementation of evaluations."""
@@ -15,7 +15,8 @@ class TestEvaluationV1(TestAPIBase):
1515
1616 def setUp (self ) -> None :
1717 super ().setUp ()
18- self .resource = EvaluationV1API (self .http_client )
18+ http_client = self .http_clients [APIVersion .V1 ]
19+ self .resource = EvaluationV1API (http_client )
1920
2021 @pytest .mark .uses_test_server ()
2122 def test_list (self ):
@@ -37,40 +38,24 @@ class TestEvaluationV2(TestAPIBase):
3738
3839 def setUp (self ) -> None :
3940 super ().setUp ()
40- self .client = self ._get_http_client (
41- server = "http://localhost:8001/" ,
42- base_url = "" ,
43- api_key = "" ,
44- retries = self .retries ,
45- retry_policy = self .retry_policy ,
46- cache = self .cache ,
47- )
48- self .resource = EvaluationV2API (self .client )
41+ http_client = self .http_clients [APIVersion .V2 ]
42+ self .resource = EvaluationV2API (http_client )
43+
44+ @pytest .mark .uses_test_server ()
45+ def test_list (self ):
46+ with pytest .raises (OpenMLNotSupportedError ):
47+ self .resource .list (
48+ function = "predictive_accuracy" ,
49+ limit = 10 ,
50+ offset = 0 ,
51+ )
52+
4953
5054
5155class TestEvaluationsCombined (TestAPIBase ):
5256 def setUp (self ):
5357 super ().setUp ()
54- self .v1_client = self .http_client
55- self .v2_client = self ._get_http_client (
56- server = "http://localhost:8001/" ,
57- base_url = "" ,
58- api_key = "" ,
59- retries = self .retries ,
60- retry_policy = self .retry_policy ,
61- cache = self .cache ,
62- )
58+ self .v1_client = self .http_clients [APIVersion .V1 ]
59+ self .v2_client = self .http_clients [APIVersion .V2 ]
6360 self .resource_v1 = EvaluationV1API (self .v1_client )
6461 self .resource_v2 = EvaluationV2API (self .v2_client )
65- self .resource_fallback = FallbackProxy (self .resource_v2 , self .resource_v1 )
66-
67- @pytest .mark .uses_test_server ()
68- def test_list_fallback (self ):
69- output_fallback = self .resource_fallback .list (
70- function = "predictive_accuracy" ,
71- limit = 10 ,
72- offset = 0 ,
73- )
74- assert isinstance (output_fallback , list )
75- assert len (output_fallback ) == 10
76- assert all (isinstance (e , OpenMLEvaluation ) for e in output_fallback )
0 commit comments