diff --git a/tests/conftest.py b/tests/conftest.py index 2a4888a50..dacc39c48 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -43,10 +43,30 @@ def backing_h5ad(tmp_path): ), ] ) -def ellipsis_index_with_equivalent(request) -> tuple[EllipsisType | slice]: +def ellipsis_index_with_equivalent( + request, +) -> tuple[tuple[EllipsisType | slice], tuple[slice, slice]]: return request.param +@pytest.fixture +def ellipsis_index( + ellipsis_index_with_equivalent: tuple[ + tuple[EllipsisType | slice], tuple[slice, slice] + ], +) -> tuple[EllipsisType | slice]: + return ellipsis_index_with_equivalent[0] + + +@pytest.fixture +def equivalent_ellipsis_index( + ellipsis_index_with_equivalent: tuple[ + tuple[EllipsisType | slice], tuple[slice, slice] + ], +) -> tuple[slice, slice]: + return ellipsis_index_with_equivalent[1] + + ##################### # Dask tokenization # ##################### diff --git a/tests/test_backed_sparse.py b/tests/test_backed_sparse.py index 699b445f4..02803012c 100644 --- a/tests/test_backed_sparse.py +++ b/tests/test_backed_sparse.py @@ -130,13 +130,13 @@ def test_backed_indexing( def test_backed_ellipsis_indexing( ondisk_equivalent_adata: tuple[AnnData, AnnData, AnnData, AnnData], - ellipsis_index_with_equivalent: tuple[EllipsisType | slice, ...], + ellipsis_index: tuple[EllipsisType | slice], + equivalent_ellipsis_index: tuple[slice], ): - ellipsis_index, equivalent_index = ellipsis_index_with_equivalent csr_mem, csr_disk, csc_disk, _ = ondisk_equivalent_adata - assert_equal(csr_mem.X[equivalent_index], csr_disk.X[ellipsis_index]) - assert_equal(csr_mem.X[equivalent_index], csc_disk.X[ellipsis_index]) + assert_equal(csr_mem.X[equivalent_ellipsis_index], csr_disk.X[ellipsis_index]) + assert_equal(csr_mem.X[equivalent_ellipsis_index], csc_disk.X[ellipsis_index]) def make_randomized_mask(size: int) -> np.ndarray: diff --git a/tests/test_views.py b/tests/test_views.py index d640cda7d..c095aa23b 100644 --- a/tests/test_views.py +++ b/tests/test_views.py @@ -791,12 +791,13 @@ def test_dataframe_view_index_setting(): def test_ellipsis_index( - ellipsis_index_with_equivalent: tuple[slice | EllipsisType, ...], matrix_type + ellipsis_index: tuple[EllipsisType | slice], + equivalent_ellipsis_index: tuple[slice], + matrix_type, ): - ellipsis_index, equivalent_index = ellipsis_index_with_equivalent adata = gen_adata((10, 10), X_type=matrix_type, **GEN_ADATA_DASK_ARGS) subset_ellipsis = adata[ellipsis_index] - subset = adata[equivalent_index] + subset = adata[equivalent_ellipsis_index] assert_equal(subset_ellipsis, subset)