pymc-labs/CausalPy

Have more coherent testing of the `summary` method

drbenvincent opened this issue · 0 comments

At the moment it seems that we only test the summary method for the pymc_experiments.DifferenceInDifferences class, and that is in the test_pymc_experiments.py file...

def test_did_summary():
"""Test that the summary stat function returns a string."""
df = cp.load_data("did")
result = cp.pymc_experiments.DifferenceInDifferences(
df,
formula="y ~ 1 + group*post_treatment",
time_variable_name="t",
group_variable_name="group",
model=cp.pymc_models.LinearRegression(sample_kwargs=sample_kwargs),
)
round_to = None
print(type(result._causal_impact_summary_stat(round_to)))
print(result._causal_impact_summary_stat(round_to))
assert isinstance(result._causal_impact_summary_stat(round_to), str)

We should make sure that we are testing the summary method for all of the pymc_experiment classes. Though I believe the InstrumentalVariable class doesn't have a summery method.

This could be done by adding more to the current test_pymc_experiments.py file, but it could be worth thinking about simply adding to existing tests in test_integration_pymc_examples.py. My thinking is that this would involve less setup / computation time as we wouldn't be doing any additional model fitting.