ehrapy icon indicating copy to clipboard operation
ehrapy copied to clipboard

Add tests for pass through calls of scanpy functions

Open eroell opened this issue 6 months ago • 1 comments

Description of feature

We are right now not testing the pass through calls of scanpy functions work smoothly. As we are using the public scanpy API and watch scanpy closely, I don't expect this to cause a lot of troubles.

Nonetheless it would be great to check during CI that this remains the case I think - else these functions are hardly covered during testing.

E.g. we could check

from types import MappingProxyType
from unittest.mock import patch

import ehrapy as ep  # import your_pass_through_function


def test_pass_through_function(adata_mini):
    with patch("scanpy.pp.neighbors") as mock_scanpy_neighbors:

        ep.pp.neighbors(adata_mini)

        mock_scanpy_neighbors.assert_called_once_with(
            adata=adata_mini,
            n_neighbors=15,
            n_pcs=None,
            use_rep=None,
            knn=True,
            random_state=0,
            method="umap",
            transformer=None,
            metric="euclidean",
            metric_kwds=MappingProxyType({}),
            key_added=None,
            copy=False
            )

Thoughts @Zethson?

eroell avatar Aug 26 '24 09:08 eroell