Skip to content

Commit 0227b4a

Browse files
committed
test plot functions
Signed-off-by: Nathaniel <[email protected]>
1 parent eae2252 commit 0227b4a

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

causalpy/pymc_experiments.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,6 +1723,8 @@ def make_hists(idata, i, axs):
17231723
axs[2].legend()
17241724
axs[2].set_title("Average Treatment Effect", fontsize=20)
17251725

1726+
return fig
1727+
17261728
def weighted_percentile(self, data, weights, perc):
17271729
"""
17281730
perc : percentile in [0-1]!
@@ -1792,3 +1794,4 @@ def plot_balance_ecdf(self, covariate, idata=None, weighting_scheme=None):
17921794
axs[0].set_xlabel("Quantiles")
17931795
axs[1].legend()
17941796
axs[0].legend()
1797+
return fig

causalpy/tests/test_pymc_experiments.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Unit tests for pymc_experiments.py
33
"""
44
import arviz as az
5+
import matplotlib as mpl
56
import pandas as pd
67

78
import causalpy as cp
@@ -77,3 +78,7 @@ def test_inverse_prop():
7778
assert isinstance(ate_list, list)
7879
ate_list = result.get_ate(0, result.idata, method="overlap")
7980
assert isinstance(ate_list, list)
81+
fig = result.plot_ATE()
82+
assert isinstance(fig, mpl.figure.Figure)
83+
fig = result.plot_balance_ecdf("age")
84+
assert isinstance(fig, mpl.figure.Figure)

0 commit comments

Comments
 (0)