Move test extras dependencies under dependency-groups#66
Merged
dcherian merged 3 commits intoxarray-contrib:mainfrom Jan 22, 2026
Merged
Move test extras dependencies under dependency-groups#66dcherian merged 3 commits intoxarray-contrib:mainfrom
dcherian merged 3 commits intoxarray-contrib:mainfrom
Conversation
Following [PEP735](https://peps.python.org/pep-0735), xref https://hatch.pypa.io/1.16/config/environment/advanced/#dependency-groups. Have also replaced fix-coord-transform-indexing branch with commit hash since pydata/xarray#10980 was merged.
Member
Author
|
Five test failures at https://github.com/xarray-contrib/rasterix/actions/runs/21012973291/job/60412040415?pr=66#step:7:35: Details=================================== FAILURES ===================================
_____________________ test_isel_basic_indexing_equivalence _____________________
[gw1] linux -- Python 3.11.14 /home/runner/.local/share/hatch/env/virtual/rasterix/4QFq6ez4/test.py3.11/bin/python
tests/test_indexing.py:68: in test_isel_basic_indexing_equivalence
@settings(suppress_health_check=[HealthCheck.function_scoped_fixture])
^^^^^^^^^^^^^^^^^^^^^^^
tests/test_indexing.py:75: in test_isel_basic_indexing_equivalence
xr.testing.assert_identical(result_raster, result_pandas)
E AssertionError: Left and right DataArray objects are not identical
E Indexes only on the right object: ['x']
E Falsifying example: test_isel_basic_indexing_equivalence(
E raster_da=<xarray.DataArray 'data' (y: 8, x: 10)> Size: 640B
E array([[ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.],
E [10., 11., 12., 13., 14., 15., 16., 17., 18., 19.],
E [20., 21., 22., 23., 24., 25., 26., 27., 28., 29.],
E [30., 31., 32., 33., 34., 35., 36., 37., 38., 39.],
E [40., 41., 42., 43., 44., 45., 46., 47., 48., 49.],
E [50., 51., 52., 53., 54., 55., 56., 57., 58., 59.],
E [60., 61., 62., 63., 64., 65., 66., 67., 68., 69.],
E [70., 71., 72., 73., 74., 75., 76., 77., 78., 79.]])
E Coordinates:
E * y (y) float64 64B -0.5 -1.5 -2.5 -3.5 -4.5 -5.5 -6.5 -7.5
E * x (x) float64 80B 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5
E Indexes:
E ┌ x RasterIndex (crs=None)
E └ y,
E pandas_da=<xarray.DataArray 'data' (y: 8, x: 10)> Size: 640B
E array([[ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.],
E [10., 11., 12., 13., 14., 15., 16., 17., 18., 19.],
E [20., 21., 22., 23., 24., 25., 26., 27., 28., 29.],
E [30., 31., 32., 33., 34., 35., 36., 37., 38., 39.],
E [40., 41., 42., 43., 44., 45., 46., 47., 48., 49.],
E [50., 51., 52., 53., 54., 55., 56., 57., 58., 59.],
E [60., 61., 62., 63., 64., 65., 66., 67., 68., 69.],
E [70., 71., 72., 73., 74., 75., 76., 77., 78., 79.]])
E Coordinates:
E * y (y) float64 64B -0.5 -1.5 -2.5 -3.5 -4.5 -5.5 -6.5 -7.5
E * x (x) float64 80B 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5,
E data=data(...),
E )
E Draw 1: {'y': 0}
E
E You can reproduce this example by temporarily adding @reproduce_failure('6.150.2', b'AAFBAABBAEEA') as a decorator on your test case
__________________________ test_outer_array_indexing ___________________________
[gw2] linux -- Python 3.11.14 /home/runner/.local/share/hatch/env/virtual/rasterix/4QFq6ez4/test.py3.11/bin/python
tests/test_indexing.py:120: in test_outer_array_indexing
@settings(suppress_health_check=[HealthCheck.function_scoped_fixture])
^^^^^^^^^^^^^^^^^^^^^^^
tests/test_indexing.py:129: in test_outer_array_indexing
xr.testing.assert_identical(result_raster, result_pandas)
E AssertionError: Left and right DataArray objects are not identical
E Differing indexes:
E L x RasterIndex(crs=None)
E AxisAffineTransformIndex(AxisAffineTransform(a=1, b=0, c=0.5, d=0, e=-1, f=-0.5, axis=X, dim='x'))
E AxisAffineTransformIndex(AxisAffineTransform(a=1, b=0, c=0.5, d=0, e=-1, f=-0.5, axis=Y, dim='y'))
E R x PandasIndex(Index([0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5], dtype='float64', name='x'))
E L y RasterIndex(crs=None)
E AxisAffineTransformIndex(AxisAffineTransform(a=1, b=0, c=0.5, d=0, e=-1, f=-0.5, axis=X, dim='x'))
E AxisAffineTransformIndex(AxisAffineTransform(a=1, b=0, c=0.5, d=0, e=-1, f=-0.5, axis=Y, dim='y'))
E R y PandasIndex(Index([-0.5, -1.5, -2.5, -3.5, -4.5, -5.5, -6.5, -7.5], dtype='float64', name='y'))
E Falsifying example: test_outer_array_indexing(
E raster_da=<xarray.DataArray 'data' (y: 8, x: 10)> Size: 640B
E array([[ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.],
E [10., 11., 12., 13., 14., 15., 16., 17., 18., 19.],
E [20., 21., 22., 23., 24., 25., 26., 27., 28., 29.],
E [30., 31., 32., 33., 34., 35., 36., 37., 38., 39.],
E [40., 41., 42., 43., 44., 45., 46., 47., 48., 49.],
E [50., 51., 52., 53., 54., 55., 56., 57., 58., 59.],
E [60., 61., 62., 63., 64., 65., 66., 67., 68., 69.],
E [70., 71., 72., 73., 74., 75., 76., 77., 78., 79.]])
E Coordinates:
E * y (y) float64 64B -0.5 -1.5 -2.5 -3.5 -4.5 -5.5 -6.5 -7.5
E * x (x) float64 80B 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5
E Indexes:
E ┌ x RasterIndex (crs=None)
E └ y,
E pandas_da=<xarray.DataArray 'data' (y: 8, x: 10)> Size: 640B
E array([[ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.],
E [10., 11., 12., 13., 14., 15., 16., 17., 18., 19.],
E [20., 21., 22., 23., 24., 25., 26., 27., 28., 29.],
E [30., 31., 32., 33., 34., 35., 36., 37., 38., 39.],
E [40., 41., 42., 43., 44., 45., 46., 47., 48., 49.],
E [50., 51., 52., 53., 54., 55., 56., 57., 58., 59.],
E [60., 61., 62., 63., 64., 65., 66., 67., 68., 69.],
E [70., 71., 72., 73., 74., 75., 76., 77., 78., 79.]])
E Coordinates:
E * y (y) float64 64B -0.5 -1.5 -2.5 -3.5 -4.5 -5.5 -6.5 -7.5
E * x (x) float64 80B 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5,
E data=data(...),
E )
E Draw 1: {}
E
E You can reproduce this example by temporarily adding @reproduce_failure('6.150.2', b'AAA=') as a decorator on your test case
_____________________ test_sel_basic_indexing_equivalence ______________________
[gw1] linux -- Python 3.11.14 /home/runner/.local/share/hatch/env/virtual/rasterix/4QFq6ez4/test.py3.11/bin/python
tests/test_indexing.py:79: in test_sel_basic_indexing_equivalence
@settings(
tests/test_indexing.py:96: in test_sel_basic_indexing_equivalence
xr.testing.assert_identical(result_raster, result_pandas)
E AssertionError: Left and right DataArray objects are not identical
E Indexes only on the right object: ['y']
E Falsifying example: test_sel_basic_indexing_equivalence(
E raster_da=<xarray.DataArray 'data' (y: 8, x: 10)> Size: 640B
E array([[ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.],
E [10., 11., 12., 13., 14., 15., 16., 17., 18., 19.],
E [20., 21., 22., 23., 24., 25., 26., 27., 28., 29.],
E [30., 31., 32., 33., 34., 35., 36., 37., 38., 39.],
E [40., 41., 42., 43., 44., 45., 46., 47., 48., 49.],
E [50., 51., 52., 53., 54., 55., 56., 57., 58., 59.],
E [60., 61., 62., 63., 64., 65., 66., 67., 68., 69.],
E [70., 71., 72., 73., 74., 75., 76., 77., 78., 79.]])
E Coordinates:
E * y (y) float64 64B -0.5 -1.5 -2.5 -3.5 -4.5 -5.5 -6.5 -7.5
E * x (x) float64 80B 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5
E Indexes:
E ┌ x RasterIndex (crs=None)
E └ y,
E pandas_da=<xarray.DataArray 'data' (y: 8, x: 10)> Size: 640B
E array([[ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.],
E [10., 11., 12., 13., 14., 15., 16., 17., 18., 19.],
E [20., 21., 22., 23., 24., 25., 26., 27., 28., 29.],
E [30., 31., 32., 33., 34., 35., 36., 37., 38., 39.],
E [40., 41., 42., 43., 44., 45., 46., 47., 48., 49.],
E [50., 51., 52., 53., 54., 55., 56., 57., 58., 59.],
E [60., 61., 62., 63., 64., 65., 66., 67., 68., 69.],
E [70., 71., 72., 73., 74., 75., 76., 77., 78., 79.]])
E Coordinates:
E * y (y) float64 64B -0.5 -1.5 -2.5 -3.5 -4.5 -5.5 -6.5 -7.5
E * x (x) float64 80B 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5,
E data=data(...),
E )
E Draw 1: {'x': np.float64(0.5)}
E
E You can reproduce this example by temporarily adding @reproduce_failure('6.150.2', b'AAFBAABBAEEAAA==') as a decorator on your test case
_______________________ test_outer_array_label_indexing ________________________
[gw2] linux -- Python 3.11.14 /home/runner/.local/share/hatch/env/virtual/rasterix/4QFq6ez4/test.py3.11/bin/python
tests/test_indexing.py:133: in test_outer_array_label_indexing
@settings(
tests/test_indexing.py:142: in test_outer_array_label_indexing
xr.testing.assert_identical(result_raster, result_pandas)
E AssertionError: Left and right DataArray objects are not identical
E Differing indexes:
E L x RasterIndex(crs=None)
E AxisAffineTransformIndex(AxisAffineTransform(a=1, b=0, c=0.5, d=0, e=-1, f=-0.5, axis=X, dim='x'))
E AxisAffineTransformIndex(AxisAffineTransform(a=1, b=0, c=0.5, d=0, e=-1, f=-0.5, axis=Y, dim='y'))
E R x PandasIndex(Index([0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5], dtype='float64', name='x'))
E L y RasterIndex(crs=None)
E AxisAffineTransformIndex(AxisAffineTransform(a=1, b=0, c=0.5, d=0, e=-1, f=-0.5, axis=X, dim='x'))
E AxisAffineTransformIndex(AxisAffineTransform(a=1, b=0, c=0.5, d=0, e=-1, f=-0.5, axis=Y, dim='y'))
E R y PandasIndex(Index([-0.5, -1.5, -2.5, -3.5, -4.5, -5.5, -6.5, -7.5], dtype='float64', name='y'))
E Falsifying example: test_outer_array_label_indexing(
E raster_da=<xarray.DataArray 'data' (y: 8, x: 10)> Size: 640B
E array([[ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.],
E [10., 11., 12., 13., 14., 15., 16., 17., 18., 19.],
E [20., 21., 22., 23., 24., 25., 26., 27., 28., 29.],
E [30., 31., 32., 33., 34., 35., 36., 37., 38., 39.],
E [40., 41., 42., 43., 44., 45., 46., 47., 48., 49.],
E [50., 51., 52., 53., 54., 55., 56., 57., 58., 59.],
E [60., 61., 62., 63., 64., 65., 66., 67., 68., 69.],
E [70., 71., 72., 73., 74., 75., 76., 77., 78., 79.]])
E Coordinates:
E * y (y) float64 64B -0.5 -1.5 -2.5 -3.5 -4.5 -5.5 -6.5 -7.5
E * x (x) float64 80B 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5
E Indexes:
E ┌ x RasterIndex (crs=None)
E └ y,
E pandas_da=<xarray.DataArray 'data' (y: 8, x: 10)> Size: 640B
E array([[ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.],
E [10., 11., 12., 13., 14., 15., 16., 17., 18., 19.],
E [20., 21., 22., 23., 24., 25., 26., 27., 28., 29.],
E [30., 31., 32., 33., 34., 35., 36., 37., 38., 39.],
E [40., 41., 42., 43., 44., 45., 46., 47., 48., 49.],
E [50., 51., 52., 53., 54., 55., 56., 57., 58., 59.],
E [60., 61., 62., 63., 64., 65., 66., 67., 68., 69.],
E [70., 71., 72., 73., 74., 75., 76., 77., 78., 79.]])
E Coordinates:
E * y (y) float64 64B -0.5 -1.5 -2.5 -3.5 -4.5 -5.5 -6.5 -7.5
E * x (x) float64 80B 0.5 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5,
E data=data(...),
E )
E Draw 1: {}
E
E You can reproduce this example by temporarily adding @reproduce_failure('6.150.2', b'AAA=') as a decorator on your test case
_______________________________ test_simple_isel _______________________________
[gw1] linux -- Python 3.11.14 /home/runner/.local/share/hatch/env/virtual/rasterix/4QFq6ez4/test.py3.11/bin/python
tests/test_indexing.py:102: in test_simple_isel
xr.testing.assert_identical(raster_da.isel(x=0), pandas_da.isel(x=0))
E AssertionError: Left and right DataArray objects are not identical
E Indexes only on the right object: ['y']Seems to be because |
Since pydata/xarray#11035, `xarray.testing.assert_identical` compares xindexes too, which fails the test because RasterIndex and PandasIndex has different types. Using `assert_equal` which only checks the DataArray. Ideally should check that the index values are equal too somehow.
weiji14
commented
Jan 15, 2026
tests/test_indexing.py
Outdated
| result_raster = raster_da.isel(indexers) | ||
| result_pandas = pandas_da.isel(indexers) | ||
| xr.testing.assert_identical(result_raster, result_pandas) | ||
| xr.testing.assert_equal(result_raster, result_pandas) |
Member
Author
There was a problem hiding this comment.
Wanted to also do some sort of comparison on the RasterIndex and PandasIndex values like:
xr.core.indexes.indexes_identical(result_raster.xindexes, result_pandas.xindexes)But that would require a bit more work, and unsure whether to have that comparison check code live upstream in pydata/xarray or here in rasterix.
Add internal _as_pandas_index() method to RasterIndex for converting to equivalent PandasIndex objects. Create assert_identical() helper in tests that compares data values via xr.testing.assert_equal and verifies index equivalence by comparing RasterIndex to PandasIndex. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.
Following PEP735, move test (development) dependencies away from test extras into a separate dependency-group.
Have also replaced fix-coord-transform-indexing branch with commit hash since pydata/xarray#10980 was merged.
References:
Addresses #65