forked from openml/openml-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_openml.py
More file actions
43 lines (35 loc) · 1.43 KB
/
test_openml.py
File metadata and controls
43 lines (35 loc) · 1.43 KB
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
38
39
40
41
42
43
# License: BSD 3-Clause
from unittest import mock
from openml.testing import TestBase
import openml
class TestInit(TestBase):
# Splitting not helpful, these test's don't rely on the server and take less
# than 1 seconds
@mock.patch('openml.tasks.functions.get_task')
@mock.patch('openml.datasets.functions.get_dataset')
@mock.patch('openml.flows.functions.get_flow')
@mock.patch('openml.runs.functions.get_run')
def test_populate_cache(
self,
run_mock,
flow_mock,
dataset_mock,
task_mock,
):
openml.populate_cache(task_ids=[1, 2], dataset_ids=[3, 4],
flow_ids=[5, 6], run_ids=[7, 8])
self.assertEqual(run_mock.call_count, 2)
for argument, fixture in zip(run_mock.call_args_list, [(7,), (8,)]):
self.assertEqual(argument[0], fixture)
self.assertEqual(flow_mock.call_count, 2)
for argument, fixture in zip(flow_mock.call_args_list, [(5,), (6,)]):
self.assertEqual(argument[0], fixture)
self.assertEqual(dataset_mock.call_count, 2)
for argument, fixture in zip(
dataset_mock.call_args_list,
[(3,), (4,)],
):
self.assertEqual(argument[0], fixture)
self.assertEqual(task_mock.call_count, 2)
for argument, fixture in zip(task_mock.call_args_list, [(1,), (2,)]):
self.assertEqual(argument[0], fixture)