Skip to content

tests: remove byte-identical duplicate test cases - #9051

Open
aymuos15 wants to merge 2 commits into
Project-MONAI:devfrom
aymuos15:test/remove-duplicate-test-cases
Open

tests: remove byte-identical duplicate test cases#9051
aymuos15 wants to merge 2 commits into
Project-MONAI:devfrom
aymuos15:test/remove-duplicate-test-cases

Conversation

@aymuos15

@aymuos15 aymuos15 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Description

Test-suite cleanup: removes parametrized test cases that are byte-identical duplicates of
another case in the same file, so each was silently running the same test twice. Follows
the earlier byte-identical-entry pass (#8942) with a focus on duplicates spread across
differently-named TEST_CASE_* variables that feed the same @parameterized.expand.

Changes, per file (duplicate → surviving twin):

  • tests/transforms/test_load_image.py — drop TEST_CASE_2 (=1), TEST_CASE_4 (=3),
    TEST_CASE_7 (=6), TEST_CASE_9 (=8); the two test_*_reader expand lists lose the
    corresponding slots (7 cases → 5 and 5 → 3).
  • tests/transforms/spatial/test_grid_patch.py / test_grid_patchd.py — drop the
    TEST_CASE_4 that is byte-identical to TEST_CASE_3 (offset (0, 0)), and its slot in
    the per-backend TEST_NDARRAYS expansion.
  • tests/transforms/spatial/test_rand_grid_patch.py / test_rand_grid_patchd.py — drop
    TEST_CASE_3, byte-identical to TEST_CASE_0 (min/max_offset 0), and its slot.
  • tests/fl/monai_algo/test_fl_monai_algo.py — drop TEST_TRAIN_3, byte-identical to
    TEST_TRAIN_1; the train expand list goes from 4 cases to 3 (one full FL train
    round-trip no longer runs twice).
  • tests/inferers/test_patch_inferer.pyTEST_CASE_ERROR_10 was byte-identical to
    TEST_CASE_ERROR_7 and never referenced by any expand list (the error tests
    parametrize over _0 .. _9 only). Dead code; removed.

Test-only change: no production code touched, no behaviour altered — each removed case
re-ran an identical parametrization. Collected test counts before → after (identical
cases removed, coverage unchanged):

file cases before after
test_load_image.py 51 47
grid_patch 70 66
grid_patchd 68 64
rand_grid_patch 58 54
rand_grid_patchd 56 52
fl_monai_algo 10 9
patch_inferer 46 46 (dead code only)

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

Signed-off-by: Soumya Snigdha Kundu <soumya_snigdha.kundu@kcl.ac.uk>
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c2f173bc-66e4-4e03-a72f-05761469554c

📥 Commits

Reviewing files that changed from the base of the PR and between 87060c4 and 737bbbd.

📒 Files selected for processing (7)
  • tests/fl/monai_algo/test_fl_monai_algo.py
  • tests/inferers/test_patch_inferer.py
  • tests/transforms/spatial/test_grid_patch.py
  • tests/transforms/spatial/test_grid_patchd.py
  • tests/transforms/spatial/test_rand_grid_patch.py
  • tests/transforms/spatial/test_rand_grid_patchd.py
  • tests/transforms/test_load_image.py
💤 Files with no reviewable changes (5)
  • tests/inferers/test_patch_inferer.py
  • tests/transforms/spatial/test_grid_patchd.py
  • tests/transforms/spatial/test_rand_grid_patch.py
  • tests/transforms/spatial/test_rand_grid_patchd.py
  • tests/transforms/spatial/test_grid_patch.py

📝 Walkthrough

Walkthrough

The changes remove duplicate or unused test cases from federated learning, inferer, spatial transform, and image-loading test modules. Removed cases are also deleted from their parameterized test collections. Remaining test coverage and test behavior are unchanged.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the duplicate-test cleanup, affected files, test-count changes, and change type; only the issue reference line is missing.
Title check ✅ Passed The title clearly and concisely summarizes the removal of byte-identical duplicate test cases.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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