Skip to content

Test coverage: morphology edge inputs (Inf, all-NaN, strip, integer)#3415

Open
brendancol wants to merge 3 commits into
mainfrom
deep-sweep-test-coverage-morphology-2026-06-20
Open

Test coverage: morphology edge inputs (Inf, all-NaN, strip, integer)#3415
brendancol wants to merge 3 commits into
mainfrom
deep-sweep-test-coverage-morphology-2026-06-20

Conversation

@brendancol

Copy link
Copy Markdown
Contributor

Closes #3404

Adds test-only coverage for four morphology edge inputs that the source already handles correctly but no test exercised. No source changes.

  • Inf / -Inf inputs: confirm they flow through the min/max kernel and the NaN-propagation branch without turning into NaN
  • All-NaN raster: confirm every op returns all NaN
  • Nx1 / 1xN strip rasters: confirm shape is preserved on the dask map_overlap path where one axis is narrower than the overlap depth
  • Integer-dtype input: confirm it is accepted and promoted to float64

Backends: numpy plus dask, cupy, and dask+cupy parity where applicable, using the cross-backend helpers in general_checks.py. The cupy and dask+cupy variants ran on a GPU host before this PR.

Test plan

  • new tests pass on numpy, dask, cupy, dask+cupy (GPU host)
  • full test_morphology.py and test_morphology_derived.py pass (86 tests)

Test-only. Covers four edge inputs that the source already handles
correctly but no test exercised:

- Inf / -Inf flow through the min/max kernel and the NaN branch
- all-NaN raster stays NaN across all four ops
- Nx1 / 1xN strip rasters keep shape on the map_overlap path
- integer dtype input is accepted and promoted to float64

numpy plus dask / cupy parity where applicable.

@brendancol brendancol left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

PR Review: morphology edge-input coverage (Inf, all-NaN, strip, integer)

Test-only PR. No source files changed, so the correctness / backend / performance / docs categories are mostly N/A. I reviewed the four new test groups in test_morphology.py.

Blockers

None.

Suggestions

None blocking.

Nits

  • The all-NaN, strip, and integer-dtype tests cover numpy and dask but not cupy. That is fine here: the GPU min/max kernel logic is identical and is already cross-checked by the broad erode/dilate cupy parity tests plus the new Inf cupy parity test. Adding cupy variants would be belt-and-suspenders, not a real gap.

What looks good

  • Inf tests assert concrete min/max values and finite-vs-inf positions, not just "runs without error".
  • Inf parity covered on numpy, dask, and cupy.
  • Strip and integer tests are parametrized over both orientations and three integer dtypes.
  • all-NaN uses boundary='nearest', so the assertion isolates the all-NaN input rather than edge padding.
  • New tests pass alongside the existing 86-test suite.

Checklist

  • Source unchanged, no algorithm to verify
  • Backends consistent: parity asserted for Inf (numpy/dask/cupy), all-NaN and strip (numpy/dask)
  • NaN handling correct
  • Edge cases covered (the point of the PR)
  • Dask boundaries: strip tests hit the degenerate-axis map_overlap path
  • No premature materialization: .compute() only in assertions
  • Benchmark not needed, test-only
  • README matrix not needed, no new function
  • Docstrings present on each test

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.

Test coverage gaps in morphology: Inf, all-NaN, strip rasters, integer dtype

1 participant