Skip to content

test(image-redactor): un-shadow the _check_if_greyscale happy-path test - #2252

Open
Anai-Guo wants to merge 1 commit into
data-privacy-stack:mainfrom
Anai-Guo:test/unshadow-check-if-greyscale
Open

Anai-Guo wants to merge 1 commit into
data-privacy-stack:mainfrom
Anai-Guo:test/unshadow-check-if-greyscale

Conversation

@Anai-Guo

Copy link
Copy Markdown

Change Description

In presidio-image-redactor/tests/test_dicom_image_redactor_engine.py, the happy-path test for DicomImageRedactorEngine._rescale_dcm_pixel_array() (section header at L127, docstring says _rescale_dcm_pixel_array) was copy-pasted under the name test_check_if_greyscale_happy_path — the same name as the real _check_if_greyscale() test at L109.

The second def rebinds the module-level name, so pytest only collects the later one and the _check_if_greyscale test (RGB vs. MONOCHROME detection) has silently not been running. ruff flags it as F811 Redefinition of unused test_check_if_greyscale_happy_path.

This PR renames the second function to test_rescale_dcm_pixel_array_happy_path, matching its section header and docstring. No other changes.

Verification

Run from presidio-image-redactor/ after uv sync --locked --group dev:

pytest tests/test_dicom_image_redactor_engine.py --collect-only -k "greyscale or rescale"
before 156 collected 5 passed (rescale cases only)
after 158 collected 12 passed (+2 restored _check_if_greyscale cases: 0_ORIGINAL.dcm → True, RGB_ORIGINAL.dcm → False)

The F811 for this file disappears; no new ruff findings.

🤖 Generated with Claude Code

The test for DicomImageRedactorEngine._rescale_dcm_pixel_array() was
copy-pasted under the name test_check_if_greyscale_happy_path, so it
rebound the module-level name and pytest silently stopped collecting the
real _check_if_greyscale() test above it.

Rename the second function to test_rescale_dcm_pixel_array_happy_path
(matching its section header and docstring) so both run again.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant