Skip to content

Test coverage: mahalanobis missing Inf-input, all-NaN, and degenerate-shape tests #3583

Description

@brendancol

mahalanobis() already has good backend and NaN coverage, but a few paths run untested. I probed each on a CUDA host and they all behave correctly today, so these are coverage gaps, not bugs.

  • Inf / -Inf inputs. A non-finite cell in any band maps to NaN in the output and drops out of the auto-computed statistics (the isfinite mask catches it). Nothing in the suite passes Inf, so a regression in that mask would go unnoticed. Verified identical across numpy, cupy, dask+numpy, and dask+cupy.
  • all-NaN / too-few-valid-pixels. When fewer than n_bands + 1 cells are finite, the statistics phase raises ValueError("Not enough valid pixels ..."). That branch is never exercised.
  • Degenerate shapes. A 1x1 raster with provided mean/inv_cov returns the correct distance; 1x1 with auto stats raises (too few pixels); 1xN and Nx1 strips work. None of these shapes are tested.

This is test-only work. No source changes. If a test had surfaced a bug I would have filed it separately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTest 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