test(proximity): cover Dataset input for proximity, allocation, direction#3390
Merged
brendancol merged 2 commits intoJun 19, 2026
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
test_dataset_input_processes_each_variabletotest_proximity.py. It covers the@supports_datasetpath ofproximity,allocation, anddirection.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 aDataArrayinstead. The decorator itself has generic coverage intest_dataset_support.py, but that file doesn't list these three functions, so nothing checked how they actually behave through it: the per-variable_processdispatch, the attrs and coords round-trip, and theresult.name = Nonereset 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.