Skip to content

Commit 37515db

Browse files
committed
test _causal_impact_summary_stat
1 parent 344b9bb commit 37515db

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"""
2+
Unit tests for pymc_experiments.py
3+
"""
4+
5+
import causalpy as cp
6+
7+
sample_kwargs = {"tune": 20, "draws": 20, "chains": 2, "cores": 2}
8+
9+
10+
def test_did_summary():
11+
"""Test that the summary stat function returns a string."""
12+
df = cp.load_data("did")
13+
result = cp.pymc_experiments.DifferenceInDifferences(
14+
df,
15+
formula="y ~ 1 + group*post_treatment",
16+
time_variable_name="t",
17+
group_variable_name="group",
18+
model=cp.pymc_models.LinearRegression(sample_kwargs=sample_kwargs),
19+
)
20+
print(type(result._causal_impact_summary_stat()))
21+
assert isinstance(result._causal_impact_summary_stat(), str)

docs/source/_static/interrogate_badge.svg

Lines changed: 3 additions & 3 deletions
Loading

0 commit comments

Comments
 (0)