Skip to content

Improve consistency of test variable names and ordering#310

Merged
PGijsbers merged 3 commits intomainfrom
refactor-rename
Apr 11, 2026
Merged

Improve consistency of test variable names and ordering#310
PGijsbers merged 3 commits intomainfrom
refactor-rename

Conversation

@PGijsbers
Copy link
Copy Markdown
Contributor

Update the tests to be more consistent with variable naming and ordering in assertions.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ac6e6e2d-c560-4d59-aa85-dd8372ca4d70

📥 Commits

Reviewing files that changed from the base of the PR and between 6ee1ded and 530061b.

📒 Files selected for processing (2)
  • pyproject.toml
  • tests/routers/openml/datasets_list_datasets_test.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/routers/openml/datasets_list_datasets_test.py

Walkthrough

Refactors many test files: swapped equality assertion operand order (e.g., expected == actualactual == expected), renamed response/local variables from generic names like new/original/response to py_response/php_response/py_json, and updated helper parameters and comparisons to the new names. One test consolidates nested assertions into a single flattened check. No test inputs, expected values, or exported/public APIs were changed.

Possibly related PRs

Suggested labels

tests

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and accurately summarizes the main changes: refactoring test variable names and assertion operand ordering for consistency across multiple test files.
Description check ✅ Passed The description appropriately captures the scope of the changeset, referring to the main objective of updating tests for consistency in variable naming and assertion ordering.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor-rename

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@PGijsbers PGijsbers changed the title Refactor rename Improve consistency of test variable names and ordering Apr 11, 2026
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 11, 2026

Codecov Report

❌ Patch coverage is 89.14027% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.57%. Comparing base (e90ec4d) to head (530061b).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...outers/openml/migration/datasets_migration_test.py 75.86% 10 Missing and 4 partials ⚠️
...routers/openml/migration/studies_migration_test.py 57.14% 3 Missing and 3 partials ⚠️
.../routers/openml/migration/setups_migration_test.py 93.65% 2 Missing and 2 partials ⚠️

❌ Your patch status has failed because the patch coverage (89.14%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #310      +/-   ##
==========================================
- Coverage   93.57%   93.57%   -0.01%     
==========================================
  Files          72       72              
  Lines        3113     3112       -1     
  Branches      222      220       -2     
==========================================
- Hits         2913     2912       -1     
  Misses        143      143              
  Partials       57       57              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
tests/routers/openml/migration/setups_migration_test.py (1)

101-105: Avoid order-dependent unpacking from error.values().

Line 101 relies on JSON key order. Read code and message by key to make the assertion stable.

Suggested patch
-    code, message = php_response.json()["error"].values()
+    error = php_response.json()["error"]
+    code = error["code"]
+    message = error["message"]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/routers/openml/migration/setups_migration_test.py` around lines 101 -
105, The test unpacks php_response.json()["error"].values() which is
order-dependent; instead extract the error dict and read keys explicitly (e.g.
error = php_response.json()["error"]; use error["code"] and error["message"])
and then assert py_response.json()["code"] equals that code and message equals
"Tag is not owned by you" to make the assertions stable; update references to
php_response and py_response accordingly.
tests/routers/openml/migration/flows_migration_test.py (1)

69-69: Assert PHP status explicitly before parsing payload.

On Line 69 only py_response is asserted OK; then Line 92 assumes PHP success shape (["flow"]). Add an explicit assert php_response.status_code == HTTPStatus.OK to fail with a clearer reason.

Suggested patch
-    assert py_response.status_code == HTTPStatus.OK
+    assert py_response.status_code == HTTPStatus.OK
+    assert php_response.status_code == HTTPStatus.OK

Also applies to: 92-92

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/routers/openml/migration/flows_migration_test.py` at line 69, Add an
explicit assertion that php_response.status_code == HTTPStatus.OK before any
parsing or indexing of php_response.json() (the test currently only asserts
py_response.status_code == HTTPStatus.OK), so modify the test around the
php_response usage (referencing the php_response variable and HTTPStatus.OK) to
fail fast with a clear message if the PHP call did not succeed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/routers/openml/migration/flows_migration_test.py`:
- Line 69: Add an explicit assertion that php_response.status_code ==
HTTPStatus.OK before any parsing or indexing of php_response.json() (the test
currently only asserts py_response.status_code == HTTPStatus.OK), so modify the
test around the php_response usage (referencing the php_response variable and
HTTPStatus.OK) to fail fast with a clear message if the PHP call did not
succeed.

In `@tests/routers/openml/migration/setups_migration_test.py`:
- Around line 101-105: The test unpacks php_response.json()["error"].values()
which is order-dependent; instead extract the error dict and read keys
explicitly (e.g. error = php_response.json()["error"]; use error["code"] and
error["message"]) and then assert py_response.json()["code"] equals that code
and message equals "Tag is not owned by you" to make the assertions stable;
update references to php_response and py_response accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 12c2706c-2c0e-4244-8f3a-741f71cfd7fd

📥 Commits

Reviewing files that changed from the base of the PR and between e90ec4d and 6ee1ded.

📒 Files selected for processing (19)
  • tests/config_test.py
  • tests/dependencies/fetch_user_test.py
  • tests/routers/openml/dataset_tag_test.py
  • tests/routers/openml/datasets_list_datasets_test.py
  • tests/routers/openml/datasets_qualities_test.py
  • tests/routers/openml/migration/datasets_migration_test.py
  • tests/routers/openml/migration/evaluations_migration_test.py
  • tests/routers/openml/migration/flows_migration_test.py
  • tests/routers/openml/migration/runs_migration_test.py
  • tests/routers/openml/migration/setups_migration_test.py
  • tests/routers/openml/migration/studies_migration_test.py
  • tests/routers/openml/migration/tasks_migration_test.py
  • tests/routers/openml/qualities_list_test.py
  • tests/routers/openml/setups_tag_test.py
  • tests/routers/openml/setups_untag_test.py
  • tests/routers/openml/study_post_test.py
  • tests/routers/openml/task_list_test.py
  • tests/routers/openml/task_type_get_test.py
  • tests/routers/openml/task_type_list_test.py

@PGijsbers PGijsbers merged commit 3e9042a into main Apr 11, 2026
7 of 9 checks passed
@PGijsbers PGijsbers deleted the refactor-rename branch April 11, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant