Skip to content

Commit 93af81b

Browse files
committed
fix issues with unit test
1 parent f659329 commit 93af81b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/test_evaluations/test_evaluation_functions.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,22 +118,22 @@ def test_evaluation_list_per_fold(self):
118118
self.assertIsNone(evaluations[run_id].values)
119119

120120
def test_evaluation_list_sort(self):
121-
openml.config.server = self.test_server
122121
size = 10
123-
task_id = 1769
122+
task_id = 115
124123
# Get all evaluations of the task
125124
unsorted_eval = openml.evaluations.list_evaluations(
126125
"predictive_accuracy", offset=0, task=[task_id])
127126
# Get top 10 evaluations of the same task
128127
sorted_eval = openml.evaluations.list_evaluations(
129128
"predictive_accuracy", size=size, offset=0, task=[task_id], sort_order="desc")
130-
129+
self.assertEqual(len(sorted_eval), size)
130+
self.assertGreater(len(unsorted_eval),0)
131131
sorted_output = []
132132
unsorted_output = []
133-
for run_id in sorted_eval.keys():
134-
sorted_output.append(sorted_eval[run_id].value)
135-
for run_id in unsorted_eval.keys():
136-
unsorted_output.append(unsorted_eval[run_id].value)
133+
for eval in sorted_eval.values():
134+
sorted_output.append(eval.value)
135+
for eval in unsorted_eval.values():
136+
unsorted_output.append(eval.value)
137137

138138
# Check if output from sort is sorted in the right order
139139
self.assertTrue(sorted(sorted_output, reverse=True) == sorted_output)

0 commit comments

Comments
 (0)