forked from openml/openml-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_supervised_task.py
More file actions
37 lines (26 loc) · 893 Bytes
/
test_supervised_task.py
File metadata and controls
37 lines (26 loc) · 893 Bytes
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
# License: BSD 3-Clause
from typing import Tuple
import unittest
import numpy as np
from openml.tasks import get_task
from .test_task import OpenMLTaskTest
class OpenMLSupervisedTaskTest(OpenMLTaskTest):
"""
A helper class. The methods of the test case
are only executed in subclasses of the test case.
"""
__test__ = False
@classmethod
def setUpClass(cls):
if cls is OpenMLSupervisedTaskTest:
raise unittest.SkipTest(
"Skip OpenMLSupervisedTaskTest tests,"
" it's a base class"
)
super(OpenMLSupervisedTaskTest, cls).setUpClass()
def setUp(self, n_levels: int = 1):
super(OpenMLSupervisedTaskTest, self).setUp()
def test_get_X_and_Y(self) -> Tuple[np.ndarray, np.ndarray]:
task = get_task(self.task_id)
X, Y = task.get_X_and_y()
return X, Y