Skip to content

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

@brendancol

Description

@brendancol

Summary

The morphology module (erode, dilate, opening, closing, gradient, white/black top-hat) already has solid backend and edge-case coverage, but a few edge inputs are never exercised by the test suite. The source handles them correctly today, so these are regression guards rather than bug reports.

Gaps found by /sweep-test-coverage

  1. Infinite inputs (+Inf / -Inf). No test passes Inf to any morphology function. Inf interacts with the min/max kernel and with the NaN-propagation branch (the v != v check), so a future refactor of that branch could silently break Inf handling and no test would catch it.
  2. All-NaN raster. The all-NaN case is not tested. Every cell sees only NaN neighbours and should return NaN.
  3. Degenerate strip rasters (Nx1 and 1xN). The single-pixel (1x1) case is covered, but column and row strips are not. These exercise the dask map_overlap path where one dimension is narrower than the overlap depth.
  4. Integer-dtype input. The numpy path casts to float64 via astype; no test confirms integer input is accepted and promoted.

Proposed fix

Add tests only, no source changes. Cover the four gaps above on numpy and, where applicable, dask / cupy / dask+cupy using the cross-backend helpers in general_checks.py.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsweep-test-coverageFound by /sweep-test-coveragetestsTest coverage and parity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions