Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix unit test
  • Loading branch information
mfeurer committed Jun 16, 2023
commit 3ef4c06949f8d5c550c028189a31ce4467eb1631
16 changes: 10 additions & 6 deletions tests/test_utils/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,21 @@ def test_list_all(self):

def test_list_all_with_multiple_batches(self):
res = openml.utils._list_all(
listing_call=openml.tasks.functions._list_tasks, output_format="dict", batch_size=2000
listing_call=openml.tasks.functions._list_tasks, output_format="dict", batch_size=1050
)
# Verify that test server state is still valid for this test to work as intended
# -> If the number of results is less than 2000, the test can not test the
# batching operation.
assert len(res) > 2000
openml.utils._list_all(
# -> If the number of results is less than 1050, the test can not test the
# batching operation. By having more than 1050 results we know that batching
# was triggered. 1050 appears to be a number of tasks that is available on a fresh
# test server.
assert len(res) > 1050
res2 = openml.utils._list_all(
listing_call=openml.tasks.functions._list_tasks,
output_format="dataframe",
batch_size=2000,
batch_size=1050,
)
# It might be possible that someone added a new task in the meantime
assert len(res) <= len(res2)

@unittest.mock.patch("openml._api_calls._perform_api_call", side_effect=mocked_perform_api_call)
def test_list_all_few_results_available(self, _perform_api_call):
Expand Down