pymc-labs/CausalPy

Add test for API stability for a CausalPy example in Causal Inference and Discovery in Python by Aleksander Molak

Closed this issue · 3 comments

On pages 304-307 there is an example using CausalPy in Causal Inference and Discovery in Python by @AlxndrMlk. We should create a new pytest file which tests the API to ensure that people running this code in the future are still able to replicate the results.

It should probably be done in a new test file, something like test_api_stability.py.

A choice will have to be about reading in the data remotely or placing it internally in this repo.

To be clear, I'm not proposing that we add that example to our docs, at least not at this point :)

hi @drbenvincent, is anyone working on this issue? if not, I'd like to contribute :)

here's what I have in mind:

  1. add a test file called test_api_stability.py
  2. save the original dataset in this repo, in the data folder
  3. include a test called test_causal_inference_and_discovery_with_python_example
  4. fetch the data, and run the exact same functions used here
  5. assert that cp.pymc_models.WeightedSumFitter runs without errors and returns the expected format
  6. assert that pymc_experiments.SyntheticControl runs without errors and returns the expected format
  7. assert that calling the results plot runs without errors and returns the expected format

let me know your thoughts!

Sounds great @arthurmello! Feel free to make a start - I'll assign you to this issue now.

Thanks @drbenvincent! I just did the PR, looking forward to your review.