Skip to content

Commit eb6bca6

Browse files
Raise exception for Positive and Negative effect if multiple values passed in
1 parent c026f6a commit eb6bca6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

causal_testing/testing/causal_test_outcome.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ class Positive(SomeEffect):
9494
def apply(self, res: CausalTestResult) -> bool:
9595
if res.ci_valid() and not super().apply(res):
9696
return False
97+
if len(res.test_value.value > 0):
98+
raise ValueError("Positive Effects are currently only supported on single float datatypes")
9799
if res.test_value.type in {"ate", "coefficient"}:
98100
return bool(res.test_value.value[0] > 0)
99101
if res.test_value.type == "risk_ratio":
@@ -107,6 +109,8 @@ class Negative(SomeEffect):
107109
def apply(self, res: CausalTestResult) -> bool:
108110
if res.ci_valid() and not super().apply(res):
109111
return False
112+
if len(res.test_value.value > 0):
113+
raise ValueError("Negative Effects are currently only supported on single float datatypes")
110114
if res.test_value.type in {"ate", "coefficient"}:
111115
return bool(res.test_value.value[0] < 0)
112116
if res.test_value.type == "risk_ratio":

0 commit comments

Comments
 (0)