Skip to content

Commit cdf4382

Browse files
committed
Added test for pad_extent
1 parent 65b0a12 commit cdf4382

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

21.4 KB
Loading

‎tests/pl/test_show.py‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import matplotlib
2+
import scanpy as sc
3+
import spatialdata_plot # noqa: F401
4+
from spatialdata import SpatialData
5+
6+
from tests.conftest import PlotTester, PlotTesterMeta
7+
8+
sc.pl.set_rcParams_defaults()
9+
sc.set_figure_params(dpi=40, color_map="viridis")
10+
matplotlib.use("agg") # same as GitHub action runner
11+
_ = spatialdata_plot
12+
13+
# WARNING:
14+
# 1. all classes must both subclass PlotTester and use metaclass=PlotTesterMeta
15+
# 2. tests which produce a plot must be prefixed with `test_plot_`
16+
# 3. if the tolerance needs to be changed, don't prefix the function with `test_plot_`, but with something else
17+
# the comp. function can be accessed as `self.compare(<your_filename>, tolerance=<your_tolerance>)`
18+
# ".png" is appended to <your_filename>, no need to set it
19+
20+
21+
class TestShow(PlotTester, metaclass=PlotTesterMeta):
22+
def test_plot_pad_extent_adds_padding(self, sdata_blobs: SpatialData):
23+
sdata_blobs.pl.render_images(elements="blobs_image").pl.show(pad_extent=100)

0 commit comments

Comments
 (0)