|
a |
|
b/tests/plotting/test_plotting.py |
|
|
1 |
from anndata import AnnData |
|
|
2 |
|
|
|
3 |
import moscot.plotting as mpl |
|
|
4 |
from tests.plotting.conftest import PlotTester, PlotTesterMeta |
|
|
5 |
|
|
|
6 |
# WARNING: |
|
|
7 |
# 1. all classes must both subclass PlotTester and use metaclass=PlotTesterMeta |
|
|
8 |
# 2. tests which produce a plot must be prefixed with `test_plot_` |
|
|
9 |
# 3. if the tolerance needs to be changed, don't prefix the function with `test_plot_`, but with something else |
|
|
10 |
# the comp. function can be accessed as `self.compare(<your_filename>, tolerance=<your_tolerance>)` |
|
|
11 |
# ".png" is appended to <your_filename>, no need to set it |
|
|
12 |
|
|
|
13 |
|
|
|
14 |
class TestPlotting(PlotTester, metaclass=PlotTesterMeta): |
|
|
15 |
def test_plot_cell_transition(self, adata_pl_cell_transition: AnnData): |
|
|
16 |
mpl.cell_transition(adata_pl_cell_transition) |
|
|
17 |
|
|
|
18 |
def test_plot_cell_transition_params(self, adata_pl_cell_transition: AnnData): |
|
|
19 |
mpl.cell_transition(adata_pl_cell_transition, annotate=None, cmap="inferno", fontsize=15) |
|
|
20 |
|
|
|
21 |
def test_plot_sankey(self, adata_pl_sankey: AnnData): |
|
|
22 |
mpl.sankey(adata_pl_sankey) |
|
|
23 |
|
|
|
24 |
def test_plot_sankey_params(self, adata_pl_sankey: AnnData): |
|
|
25 |
mpl.sankey(adata_pl_sankey, captions=["Test", "Other test"], title="Title") |
|
|
26 |
|
|
|
27 |
def test_plot_push(self, adata_pl_push: AnnData): |
|
|
28 |
mpl.push(adata_pl_push, time_points=[0, 1]) |
|
|
29 |
|
|
|
30 |
def test_plot_pull(self, adata_pl_pull: AnnData): |
|
|
31 |
mpl.pull(adata_pl_pull, time_points=[0, 1]) |