-
-
Notifications
You must be signed in to change notification settings - Fork 243
MNT: Replace live server calls with mocks in tests/test_utils/test_utils.py #1679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,8 +2,13 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import os | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import unittest.mock | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import pandas as pd | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import pytest | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import openml | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from openml.evaluations.evaluation import OpenMLEvaluation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from openml.setups.setup import OpenMLSetup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from openml.testing import _check_dataset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -43,24 +48,49 @@ def min_number_evaluations_on_test_server() -> int: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return 8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def _mocked_perform_api_call(call, request_method): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| url = openml.config.server + "/" + call | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return openml._api_calls._download_text_file(url) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def _create_mock_listing_call(total_items, item_factory, return_type="dataframe"): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def mock_listing_call(limit, offset, **kwargs): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if offset >= total_items: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return pd.DataFrame() if return_type == "dataframe" else [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| size = min(limit, total_items - offset) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| items = [item_factory(i) for i in range(offset, offset + size)] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return pd.DataFrame(items) if return_type == "dataframe" else items | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return mock_listing_call | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Copilot
AI
Feb 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation for multi-line function call. The closing parenthesis should be on a new line at the same indentation level as the opening line of the function call, consistent with how similar calls are formatted elsewhere in the file (e.g., lines 82-84, 91-93, 107-109, 121-123).
| return_type="list" | |
| return_type="list", |
Copilot
AI
Feb 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation for multi-line function call. The closing parenthesis should be on a new line at the same indentation level as the opening line of the function call, consistent with how similar calls are formatted elsewhere in the file (e.g., lines 82-84, 91-93, 107-109, 121-123).
| run_id=i, task_id=1, setup_id=1, flow_id=1, flow_name="flow", data_id=1, data_name="data", | |
| function="predictive_accuracy", upload_time="2020-01-01", uploader=1, uploader_name="user", | |
| value=0.5, values=None | |
| run_id=i, | |
| task_id=1, | |
| setup_id=1, | |
| flow_id=1, | |
| flow_name="flow", | |
| data_id=1, | |
| data_name="data", | |
| function="predictive_accuracy", | |
| upload_time="2020-01-01", | |
| uploader=1, | |
| uploader_name="user", | |
| value=0.5, | |
| values=None, |
Copilot
AI
Feb 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line exceeds recommended maximum line length. The OpenMLEvaluation constructor call has very long lines (line 154 appears to be particularly long). Consider breaking this into multiple lines with one parameter per line for better readability.
| run_id=i, task_id=1, setup_id=1, flow_id=1, flow_name="flow", data_id=1, data_name="data", | |
| function="predictive_accuracy", upload_time="2020-01-01", uploader=1, uploader_name="user", | |
| value=0.5, values=None | |
| run_id=i, | |
| task_id=1, | |
| setup_id=1, | |
| flow_id=1, | |
| flow_name="flow", | |
| data_id=1, | |
| data_name="data", | |
| function="predictive_accuracy", | |
| upload_time="2020-01-01", | |
| uploader=1, | |
| uploader_name="user", | |
| value=0.5, | |
| values=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing blank line before function definition. According to PEP 8, there should be two blank lines before top-level function definitions. There's an extra blank line at line 51 which makes it appear there are two blank lines, but the standard convention is to have exactly two blank lines, not one followed by an extra one.