Skip to content

Commit db40456

Browse files
Refactor Assert statement to If statement
1 parent ef5d784 commit db40456

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

causal_testing/generation/abstract_causal_test_case.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ def __init__(
3030
effect_modifiers: set[Variable] = None,
3131
estimate_type: str = "ate",
3232
):
33-
assert treatment_variables in scenario.variables.values(), (
34-
"Treatment variables must be a subset of variables."
35-
+ f" Instead got:\ntreatment_variables={treatment_variables}\nvariables={scenario.variables}"
36-
)
33+
if treatment_variables not in scenario.variables.values():
34+
raise ValueError(
35+
"Treatment variables must be a subset of variables."
36+
+ f" Instead got:\ntreatment_variables={treatment_variables}\nvariables={scenario.variables}"
37+
)
3738

3839
assert len(expected_causal_effect) == 1, "We currently only support tests with one causal outcome"
3940

0 commit comments

Comments
 (0)