From 42daf7b31543bda3241dac054ab26e2f3967fdd3 Mon Sep 17 00:00:00 2001 From: Brendan Collins Date: Wed, 24 Jun 2026 18:12:12 -0700 Subject: [PATCH] Fix stale test_perlin coords assertion after #3470 preserved coords perlin() now carries input coordinate variables to the output (#3470), but test_perlin_drops_input_coords still asserted they were dropped, leaving main red. Rename it to test_perlin_preserves_input_coords and assert the coords are preserved and unchanged, which is what the test's own TODO called for. --- xrspatial/tests/test_perlin.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/xrspatial/tests/test_perlin.py b/xrspatial/tests/test_perlin.py index bf3fdc9e6..04d99ff04 100644 --- a/xrspatial/tests/test_perlin.py +++ b/xrspatial/tests/test_perlin.py @@ -319,17 +319,17 @@ def test_perlin_preserves_dims_and_attrs(): assert out.attrs == src.attrs -def test_perlin_drops_input_coords(): - # Pins current behavior: perlin() rebuilds the output from dims + attrs but - # not coords, so input coordinate variables are dropped. This is a known - # bug -- see the perlin "drops input coordinates from output" issue. Flip - # this to assert the coords ARE preserved once that is fixed. +def test_perlin_preserves_input_coords(): + # perlin() now carries the input coordinate variables through to the output + # (see #3470). The output keeps the same lat/lon coords as the input. src = xr.DataArray(np.zeros((10, 12), dtype=np.float32), dims=['lat', 'lon']) src['lat'] = np.arange(10) src['lon'] = np.arange(12) out = perlin(src) - assert 'lat' not in out.coords - assert 'lon' not in out.coords + assert 'lat' in out.coords + assert 'lon' in out.coords + np.testing.assert_array_equal(out['lat'].values, src['lat'].values) + np.testing.assert_array_equal(out['lon'].values, src['lon'].values) def test_perlin_docstring_documents_name():