Skip to content

Commit

Permalink
Merge pull request #12 from sdaza/dev
Browse files Browse the repository at this point in the history
new test
  • Loading branch information
sdaza authored Dec 8, 2024
2 parents f643224 + 81f7ae9 commit 1873dde
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- '**' # Triggers on pull requests to any branch

jobs:
test:
build:
runs-on: ubuntu-latest

steps:
Expand Down
4 changes: 2 additions & 2 deletions experiment_utils/experiment_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ def __init__(
assess_overlap = False):

"""
Initialize an ExperimentAnalyzer object
Initialize ExperimentAnalyzer
Parameters
----------
data : DataFrame
Dataframe containing the data
PySpark Dataframe
outcomes : List
List of outcome variables
covariates : List
Expand Down
27 changes: 24 additions & 3 deletions tests/test_experiment_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ def test_no_covariates(sample_data):
treatment_col=treatment_col,
experiment_identifier=experiment_identifier)


# This should not raise an error since all columns are present
try:
analyzer.get_effects()
analyzer.results
Expand All @@ -114,7 +112,30 @@ def test_no_adjustment(sample_data):
covariates=covariates
)

# This should not raise an error since all columns are present
try:
analyzer.get_effects()
analyzer.results
assert True
except Exception as e:
pytest.fail(f" raised an exception: {e}")


def test_ipw_adjustment(sample_data):
"""Test get_effects no adjustments"""
outcomes = "conversion"
treatment_col = "treatment"
experiment_identifier = "experiment"
covariates = "baseline_conversion"

analyzer = ExperimentAnalyzer(
data=sample_data,
outcomes=outcomes,
treatment_col=treatment_col,
experiment_identifier=experiment_identifier,
covariates=covariates,
adjustment="IPW"
)

try:
analyzer.get_effects()
analyzer.results
Expand Down

0 comments on commit 1873dde

Please sign in to comment.