Skip to content

Commit

Permalink
0.10.6 (#215)
Browse files Browse the repository at this point in the history
* updates release note

* updates for scanpy-1.10.2

* adds release note
  • Loading branch information
Intron7 authored Jun 25, 2024
1 parent 2e7d71f commit 7d550e0
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 19 deletions.
9 changes: 2 additions & 7 deletions docs/release-notes/0.10.6.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
### 0.10.6 {small}`the future`

```{rubric} Features
```

```{rubric} Performance
```
### 0.10.6 {small}`2024-06-25`

```{rubric} Bug fixes
```
* removes `.A` to be compatible with scipy 1.14.0 {pr}`214` {smaller}`S Dicks`

```{rubric} Misc
```
* updates tests to work without `scanpy.testing` {pr}`215` {smaller}`S Dicks`
41 changes: 41 additions & 0 deletions tests/_helpers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"""Like fixtures, but more flexible"""

from __future__ import annotations

from typing import TYPE_CHECKING

import pytest
from anndata.tests.helpers import asarray
from scipy import sparse


if TYPE_CHECKING:
from collections.abc import Iterable
from typing import Literal

from _pytest.mark.structures import ParameterSet


def param_with(
at: ParameterSet,
*,
marks: Iterable[pytest.Mark | pytest.MarkDecorator] = (),
id: str | None = None,
) -> ParameterSet:
return pytest.param(*at.values, marks=[*at.marks, *marks], id=id or at.id)


MAP_ARRAY_TYPES: dict[
tuple[Literal["mem", "dask"], Literal["dense", "sparse"]],
tuple[ParameterSet, ...],
] = {
("mem", "dense"): (pytest.param(asarray, id="numpy_ndarray"),),
("mem", "sparse"): (
pytest.param(sparse.csr_matrix, id="scipy_csr"),
pytest.param(sparse.csc_matrix, id="scipy_csc"),
),
}

ARRAY_TYPES_MEM = tuple(
at for (strg, _), ats in MAP_ARRAY_TYPES.items() if strg == "mem" for at in ats
)
6 changes: 3 additions & 3 deletions tests/test_aggregated.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

import scanpy as sc
from scanpy._utils import _resolve_axis
from scanpy.testing._helpers import assert_equal
from scanpy.testing._helpers.data import pbmc3k_processed
from scanpy.testing._pytest.params import ARRAY_TYPES_MEM
from anndata.tests.helpers import assert_equal
from scanpy.datasets import pbmc3k_processed
from _helpers import ARRAY_TYPES_MEM

import rapids_singlecell as rsc

Expand Down
14 changes: 11 additions & 3 deletions tests/test_pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
import pytest
import rapids_singlecell as rsc
from anndata import AnnData
from scanpy.datasets import pbmc3k_processed
from scanpy.datasets import pbmc3k_processed, pbmc3k
from scipy import sparse
import scanpy as sc
from scanpy.testing._helpers.data import pbmc3k_normalized

A_list = [
[0, 0, 7, 0, 0],
Expand Down Expand Up @@ -41,6 +40,15 @@
)


def _pbmc3k_normalized() -> AnnData:
pbmc = pbmc3k()
pbmc.X = pbmc.X.astype("float64") # For better accuracy
sc.pp.filter_genes(pbmc, min_counts=1)
sc.pp.log1p(pbmc)
sc.pp.normalize_total(pbmc)
sc.pp.highly_variable_genes(pbmc)
return pbmc

def test_pca_transform():
A = np.array(A_list).astype("float32")
A_pca_abs = np.abs(A_pca)
Expand Down Expand Up @@ -211,7 +219,7 @@ def test_pca_layer():
"""
Tests that layers works the same way as .X
"""
X_adata = pbmc3k_normalized()
X_adata = _pbmc3k_normalized()
X_adata.X = X_adata.X.astype(np.float64)

layer_adata = X_adata.copy()
Expand Down
10 changes: 4 additions & 6 deletions tests/test_scrublet.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@


def pbmc200() -> AnnData:
from scanpy.testing._helpers.data import _pbmc3k

return _pbmc3k()[200:400].copy()
from scanpy.datasets import pbmc3k
return pbmc3k()[200:400].copy()


def paul500() -> AnnData:
from scanpy.testing._helpers.data import _paul15

return _paul15()[:500].copy()
from scanpy.datasets import paul15
return paul15()[:500].copy()


@pytest.mark.parametrize(
Expand Down

0 comments on commit 7d550e0

Please sign in to comment.