Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
update tagging constraints
  • Loading branch information
janvanrijn committed Jan 8, 2024
commit e34e3eca4618f237a69ae3bfc7e8f2f9cb98c628
20 changes: 19 additions & 1 deletion tests/test_datasets/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,9 @@ def setUp(self):
self.dataset = openml.datasets.get_dataset(125, download_data=False)

def test_tagging(self):
tag = f"test_tag_OpenMLDatasetTestOnTestServer_{time()}"
# tags can be at most 64 alphanumeric (+ underscore) chars
unique_indicator = time().replace('.', '')
tag = f"test_tag_OpenMLDatasetTestOnTestServer_{unique_indicator}"
datasets = openml.datasets.list_datasets(tag=tag, output_format="dataframe")
assert datasets.empty
self.dataset.push_tag(tag)
Expand All @@ -327,6 +329,22 @@ def test_tagging(self):
datasets = openml.datasets.list_datasets(tag=tag, output_format="dataframe")
assert datasets.empty

def test_illegal_character_tag(self):
tag = "illegal_tag&"
try:
self.dataset.push_tag(tag)
assert False
except openml.exceptions.OpenMLServerException as e:
assert e.code == 477

def test_illegal_length_tag(self):
tag = "a" * 65
try:
self.dataset.push_tag(tag)
assert False
except openml.exceptions.OpenMLServerException as e:
assert e.code == 477


class OpenMLDatasetTestSparse(TestBase):
_multiprocess_can_split_ = True
Expand Down
4 changes: 3 additions & 1 deletion tests/test_flows/test_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ def test_tagging(self):
flows = openml.flows.list_flows(size=1, output_format="dataframe")
flow_id = flows["id"].iloc[0]
flow = openml.flows.get_flow(flow_id)
tag = f"test_tag_TestFlow_{time.time()}"
# tags can be at most 64 alphanumeric (+ underscore) chars
unique_indicator = time().replace('.', '')
tag = f"test_tag_TestFlow_{unique_indicator}"
flows = openml.flows.list_flows(tag=tag, output_format="dataframe")
assert len(flows) == 0
flow.push_tag(tag)
Expand Down
4 changes: 3 additions & 1 deletion tests/test_runs/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ def test_tagging(self):
assert not runs.empty, "Test server state is incorrect"
run_id = runs["run_id"].iloc[0]
run = openml.runs.get_run(run_id)
tag = f"test_tag_TestRun_{time()}"
# tags can be at most 64 alphanumeric (+ underscore) chars
unique_indicator = time().replace('.', '')
tag = f"test_tag_TestRun_{unique_indicator}"
runs = openml.runs.list_runs(tag=tag, output_format="dataframe")
assert len(runs) == 0
run.push_tag(tag)
Expand Down
4 changes: 3 additions & 1 deletion tests/test_tasks/test_task_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ def tearDown(self):

def test_tagging(self):
task = openml.tasks.get_task(1) # anneal; crossvalidation
tag = f"test_tag_OpenMLTaskMethodsTest_{time()}"
# tags can be at most 64 alphanumeric (+ underscore) chars
unique_indicator = time().replace('.', '')
tag = f"test_tag_OpenMLTaskMethodsTest_{unique_indicator}"
tasks = openml.tasks.list_tasks(tag=tag, output_format="dataframe")
assert len(tasks) == 0
task.push_tag(tag)
Expand Down