Skip to content

Commit b6ca860

Browse files
committed
Added base test case validation to check that the treatment and outcome aren't the same
1 parent e7b8577 commit b6ca860

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

causal_testing/testing/base_test_case.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ class BaseTestCase:
1414
:param effect: A string representing the effect, current support effects are 'direct' and 'total'
1515
"""
1616

17-
treatment_variable: Variable
18-
outcome_variable: Variable
19-
effect: str = Effect.TOTAL.value
17+
def __init__(self, treatment_variable: Variable, outcome_variable: Variable, effect: str = Effect.TOTAL.value):
18+
if treatment_variable == outcome_variable:
19+
raise ValueError(f"Treatment variable {treatment_variable} cannot also be the outcome.")
20+
self.treatment_variable = treatment_variable
21+
self.outcome_variable = outcome_variable
22+
self.effect = effect

0 commit comments

Comments
 (0)