Skip to content

Commit 548857e

Browse files
authored
Merge branch 'develop' into dependencies
2 parents 391ab1e + 88695c8 commit 548857e

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

openml/tasks/functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def _list_tasks(api_call):
142142
xml_string = _perform_api_call(api_call)
143143
except OpenMLServerNoResult:
144144
return []
145-
tasks_dict = xmltodict.parse(xml_string, force_list=('oml:task',))
145+
tasks_dict = xmltodict.parse(xml_string, force_list=('oml:task','oml:input'))
146146
# Minimalistic check if the XML is useful
147147
if 'oml:tasks' not in tasks_dict:
148148
raise ValueError('Error in return XML, does not contain "oml:runs": %s'

tests/test_tasks/test_task_functions.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ def test__get_estimation_procedure_list(self):
4242
self.assertIsInstance(estimation_procedures[0], dict)
4343
self.assertEqual(estimation_procedures[0]['task_type_id'], 1)
4444

45+
def test_list_clustering_task(self):
46+
# as shown by #383, clustering tasks can give list/dict casting problems
47+
openml.config.server = self.production_server
48+
openml.tasks.list_tasks(task_type_id=5, size=10)
49+
# the expected outcome is that it doesn't crash. No assertions.
50+
4551
def _check_task(self, task):
4652
self.assertEqual(type(task), dict)
4753
self.assertGreaterEqual(len(task), 2)
@@ -127,7 +133,6 @@ def assert_and_raise(*args, **kwargs):
127133
os.path.join(os.getcwd(), "tasks", "1", "tasks.xml")
128134
))
129135

130-
131136
def test_get_task_with_cache(self):
132137
openml.config.set_cache_directory(self.static_cache_dir)
133138
task = openml.tasks.get_task(1)

0 commit comments

Comments
 (0)