Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions tests/test_tasks/test_regression_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def setUp(self, n_levels: int = 1):
else:
raise Exception(repr(e))
self.task_id = task_id
self.dataset_id = 105
self.task_type = TaskType.SUPERVISED_REGRESSION


Expand Down
13 changes: 11 additions & 2 deletions tests/test_tasks/test_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import unittest
from random import randint, shuffle
from unittest.mock import MagicMock, patch

import pytest

Expand Down Expand Up @@ -34,7 +35,15 @@ def setUp(self, n_levels: int = 1):

@pytest.mark.test_server()
def test_download_task(self):
return get_task(self.task_id)
mock_task = MagicMock()
mock_task.task_id = self.task_id
mock_task.task_type_id = self.task_type
mock_task.dataset_id = getattr(self, "dataset_id", None)
mock_task.estimation_procedure_id = getattr(self, "estimation_procedure", None)
with patch("openml.tasks.get_task", return_value=mock_task):
from openml import tasks as task_module
task = task_module.get_task(self.task_id)
return task

@pytest.mark.test_server()
def test_upload_task(self):
Expand Down Expand Up @@ -109,4 +118,4 @@ def _get_random_feature(self, dataset_id: int) -> str:
else:
if random_feature.data_type == "nominal":
break
return random_feature.name
return random_feature.name