Skip to content

test(proximity): cover Dataset input for proximity, allocation, direction#3390

Merged
brendancol merged 2 commits into
mainfrom
deep-sweep-test-coverage-proximity-2026-06-18-a165aa0c
Jun 19, 2026
Merged

test(proximity): cover Dataset input for proximity, allocation, direction#3390
brendancol merged 2 commits into
mainfrom
deep-sweep-test-coverage-proximity-2026-06-18-a165aa0c

Conversation

@brendancol

Copy link
Copy Markdown
Contributor

What

Adds test_dataset_input_processes_each_variable to test_proximity.py. It covers the @supports_dataset path of proximity, allocation, and direction.

Why

All three functions are decorated with @supports_dataset, and their docstrings say a Dataset goes in and a Dataset comes out, with each data variable processed independently. Every existing test in the file passes a DataArray instead. The decorator itself has generic coverage in test_dataset_support.py, but that file doesn't list these three functions, so nothing checked how they actually behave through it: the per-variable _process dispatch, the attrs and coords round-trip, and the result.name = None reset each one does on its way out.

What the test checks

A two-variable Dataset on numpy, cupy, dask+numpy, and dask+cupy, for each of the three functions. It asserts the result is a Dataset, the variable set is unchanged, attrs survive, each variable matches the standalone DataArray call, and the coordinates round-trip. Expected values come from the numpy backend so the comparison array stays plain numpy (a cupy expected would force an implicit host copy).

Notes

Test only, no source change. I confirmed the behavior was already correct before committing, so this pins what the code does rather than fixing anything. The 12 new cases (3 functions, 4 backends) run and pass on a CUDA host; the full proximity file is 528 passed.

From the deep-sweep test-coverage pass on the proximity module.

All three public functions are decorated with @supports_dataset and
document a Dataset-in / Dataset-out contract, but no test passed a
Dataset. The shared decorator is exercised generically in
test_dataset_support.py, which never lists these three functions, so
their per-variable dispatch, attrs/coords round-trip, and the
result.name=None reset were unpinned.

Add test_dataset_input_processes_each_variable: a two-variable Dataset
across numpy / cupy / dask+numpy / dask+cupy for each function, asserting
Dataset-out, variable set, attrs preservation, per-variable equivalence
with the standalone DataArray call, and coordinate round-trip. Expected
results are built from the numpy backend to avoid an implicit cupy host
conversion. Test-only; source unchanged.

Deep-sweep test-coverage pass 4 (proximity).
…age-proximity-2026-06-18-a165aa0c

# Conflicts:
#	xrspatial/tests/test_proximity.py
@brendancol brendancol merged commit 6239de8 into main Jun 19, 2026
10 checks passed
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.

1 participant