@@ -53,37 +53,29 @@ def _check_task(self, task):
5353 def test_list_tasks_by_type (self ):
5454 tasks = openml .tasks .list_tasks (task_type_id = 3 )
5555 self .assertGreaterEqual (len (tasks ), 300 )
56- for task in tasks :
57- self ._check_task (task )
56+ for tid in tasks :
57+ self ._check_task (tasks [ tid ] )
5858
5959 def test_list_tasks_by_tag (self ):
6060 tasks = openml .tasks .list_tasks (tag = 'basic' )
6161 self .assertGreaterEqual (len (tasks ), 57 )
62- for task in tasks :
63- self ._check_task (task )
62+ for tid in tasks :
63+ self ._check_task (tasks [ tid ] )
6464
6565 def test_list_tasks (self ):
6666 tasks = openml .tasks .list_tasks ()
6767 self .assertGreaterEqual (len (tasks ), 2000 )
68- for task in tasks :
69- self ._check_task (task )
68+ for tid in tasks :
69+ self ._check_task (tasks [ tid ] )
7070
7171 def test_list_tasks_paginate (self ):
7272 size = 10
7373 max = 100
7474 for i in range (0 , max , size ):
7575 tasks = openml .tasks .list_tasks (offset = i , size = size )
7676 self .assertGreaterEqual (size , len (tasks ))
77- for task in tasks :
78- self .assertEqual (type (task ), dict )
79- self .assertGreaterEqual (len (task ), 4 )
80- self .assertIn ('tid' , task )
81- self .assertIsInstance (task ['tid' ], int )
82- self .assertIn ('did' , task )
83- self .assertIsInstance (task ['did' ], int )
84- self .assertIn ('status' , task )
85- self .assertTrue (is_string (task ['status' ]))
86- self .assertIn (task ['status' ], ['in_preparation' , 'active' , 'deactivated' ])
77+ for tid in tasks :
78+ self ._check_task (tasks [tid ])
8779
8880 def test_list_tasks_per_type_paginate (self ):
8981 size = 10
@@ -93,16 +85,8 @@ def test_list_tasks_per_type_paginate(self):
9385 for i in range (0 , max , size ):
9486 tasks = openml .tasks .list_tasks (task_type_id = j , offset = i , size = size )
9587 self .assertGreaterEqual (size , len (tasks ))
96- for task in tasks :
97- self .assertEqual (type (task ), dict )
98- self .assertGreaterEqual (len (task ), 4 )
99- self .assertIn ('tid' , task )
100- self .assertIsInstance (task ['tid' ], int )
101- self .assertIn ('did' , task )
102- self .assertIsInstance (task ['did' ], int )
103- self .assertIn ('status' , task )
104- self .assertTrue (is_string (task ['status' ]))
105- self .assertIn (task ['status' ], ['in_preparation' , 'active' , 'deactivated' ])
88+ for tid in tasks :
89+ self ._check_task (tasks [tid ])
10690
10791 def test__get_task (self ):
10892 openml .config .set_cache_directory (self .static_cache_dir )
0 commit comments