File tree Expand file tree Collapse file tree 5 files changed +30
-5
lines changed
Expand file tree Collapse file tree 5 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -316,7 +316,9 @@ def setUp(self):
316316 self .dataset = openml .datasets .get_dataset (125 , download_data = False )
317317
318318 def test_tagging (self ):
319- tag = f"test_tag_OpenMLDatasetTestOnTestServer_{ time ()} "
319+ # tags can be at most 64 alphanumeric (+ underscore) chars
320+ unique_indicator = str (time ()).replace ('.' , '' )
321+ tag = f"test_tag_OpenMLDatasetTestOnTestServer_{ unique_indicator } "
320322 datasets = openml .datasets .list_datasets (tag = tag , output_format = "dataframe" )
321323 assert datasets .empty
322324 self .dataset .push_tag (tag )
@@ -327,7 +329,6 @@ def test_tagging(self):
327329 datasets = openml .datasets .list_datasets (tag = tag , output_format = "dataframe" )
328330 assert datasets .empty
329331
330-
331332class OpenMLDatasetTestSparse (TestBase ):
332333 _multiprocess_can_split_ = True
333334
Original file line number Diff line number Diff line change @@ -150,6 +150,24 @@ def test_check_datasets_active(self):
150150 )
151151 openml .config .server = self .test_server
152152
153+ def test_illegal_character_tag (self ):
154+ dataset = openml .datasets .get_dataset (1 )
155+ tag = "illegal_tag&"
156+ try :
157+ dataset .push_tag (tag )
158+ assert False
159+ except openml .exceptions .OpenMLServerException as e :
160+ assert e .code == 477
161+
162+ def test_illegal_length_tag (self ):
163+ dataset = openml .datasets .get_dataset (1 )
164+ tag = "a" * 65
165+ try :
166+ dataset .push_tag (tag )
167+ assert False
168+ except openml .exceptions .OpenMLServerException as e :
169+ assert e .code == 477
170+
153171 def _datasets_retrieved_successfully (self , dids , metadata_only = True ):
154172 """Checks that all files for the given dids have been downloaded.
155173
Original file line number Diff line number Diff line change @@ -102,7 +102,9 @@ def test_tagging(self):
102102 flows = openml .flows .list_flows (size = 1 , output_format = "dataframe" )
103103 flow_id = flows ["id" ].iloc [0 ]
104104 flow = openml .flows .get_flow (flow_id )
105- tag = f"test_tag_TestFlow_{ time .time ()} "
105+ # tags can be at most 64 alphanumeric (+ underscore) chars
106+ unique_indicator = str (time ()).replace ('.' , '' )
107+ tag = f"test_tag_TestFlow_{ unique_indicator } "
106108 flows = openml .flows .list_flows (tag = tag , output_format = "dataframe" )
107109 assert len (flows ) == 0
108110 flow .push_tag (tag )
Original file line number Diff line number Diff line change @@ -30,7 +30,9 @@ def test_tagging(self):
3030 assert not runs .empty , "Test server state is incorrect"
3131 run_id = runs ["run_id" ].iloc [0 ]
3232 run = openml .runs .get_run (run_id )
33- tag = f"test_tag_TestRun_{ time ()} "
33+ # tags can be at most 64 alphanumeric (+ underscore) chars
34+ unique_indicator = str (time ()).replace ('.' , '' )
35+ tag = f"test_tag_TestRun_{ unique_indicator } "
3436 runs = openml .runs .list_runs (tag = tag , output_format = "dataframe" )
3537 assert len (runs ) == 0
3638 run .push_tag (tag )
Original file line number Diff line number Diff line change @@ -17,7 +17,9 @@ def tearDown(self):
1717
1818 def test_tagging (self ):
1919 task = openml .tasks .get_task (1 ) # anneal; crossvalidation
20- tag = f"test_tag_OpenMLTaskMethodsTest_{ time ()} "
20+ # tags can be at most 64 alphanumeric (+ underscore) chars
21+ unique_indicator = str (time ()).replace ('.' , '' )
22+ tag = f"test_tag_OpenMLTaskMethodsTest_{ unique_indicator } "
2123 tasks = openml .tasks .list_tasks (tag = tag , output_format = "dataframe" )
2224 assert len (tasks ) == 0
2325 task .push_tag (tag )
You can’t perform that action at this time.
0 commit comments