Skip to content

proximity: add missing backend and edge-case test coverage #2692

@brendancol

Description

@brendancol

The proximity module (proximity, allocation, direction) has good backend-parity tests for the default EUCLIDEAN metric and for max_distance, but a few gaps are left. None of these is a bug. The current behavior is correct on all four backends. The point is to pin that behavior so a regression would show up in CI.

Gaps found during a test-coverage audit:

  1. Degenerate raster shapes are untested. There's no 1x1 single pixel, no Nx1 column strip, and no 1xN row strip for any of the three functions on any backend. These shapes are where the line-sweep kernel boundaries and the GPU brute-force kernel grid sizing tend to break. I checked all three on numpy, cupy, dask+numpy, and dask+cupy; the results are correct and agree across backends.

  2. allocation and direction are only tested with EUCLIDEAN across backends. MANHATTAN and GREAT_CIRCLE run cross-backend for proximity but never for allocation or direction. Both metrics match the numpy baseline on all four backends.

  3. Nothing sets non-empty res/crs attrs on the input. So the attrs-preservation assertion in general_output_checks compares two empty dicts and proves nothing, and the res-attr-driven padding path in the bounded dask backend (get_dataarray_resolution reads attrs['res'] before falling back to coordinate spacing) is never hit with a res attr present.

Test-only change. No source changes proposed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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