Skip to content

Commit 62ba50f

Browse files
committed
Add minimum example test case
1 parent fb7603e commit 62ba50f

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

tests/__init__.py

Whitespace-only changes.

tests/test_patchworklib.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from pathlib import Path
2+
3+
import seaborn as sns
4+
5+
import patchworklib as pw
6+
7+
8+
def test_example_plot(tmp_path: Path):
9+
"""Test example plot (Only check )"""
10+
fmri = sns.load_dataset("fmri")
11+
ax1 = pw.Brick(figsize=(3, 2))
12+
sns.lineplot(
13+
x="timepoint", y="signal", hue="region", style="event", data=fmri, ax=ax1
14+
)
15+
ax1.legend(bbox_to_anchor=(1.05, 1.0), loc="upper left")
16+
ax1.set_title("ax1")
17+
18+
titanic = sns.load_dataset("titanic")
19+
ax2 = pw.Brick(figsize=(1, 2))
20+
sns.barplot(x="sex", y="survived", hue="class", data=titanic, ax=ax2)
21+
ax2.move_legend(new_loc="upper left", bbox_to_anchor=(1.05, 1.0))
22+
ax2.set_title("ax2")
23+
24+
result_file = tmp_path / "ax12.png"
25+
ax12 = ax1 | ax2
26+
ax12.savefig(result_file)
27+
assert result_file.exists()

0 commit comments

Comments
 (0)