Skip to content

Commit 53b2a91

Browse files
authored
Merge pull request #241 from CITCOM-project/fix-json-adequacy-bug
Fixed "np.int64" is not JSON encodable from test outcomes
2 parents 67213a4 + 189c210 commit 53b2a91

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

causal_testing/testing/causal_test_outcome.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ def apply(self, res: CausalTestResult) -> bool:
9797
if res.ci_valid() and not super().apply(res):
9898
return False
9999
if res.test_value.type in {"ate", "coefficient"}:
100-
return res.test_value.value > 0
100+
return bool(res.test_value.value > 0)
101101
if res.test_value.type == "risk_ratio":
102-
return res.test_value.value > 1
102+
return bool(res.test_value.value > 1)
103103
# Dead code but necessary for pylint
104104
raise ValueError(f"Test Value type {res.test_value.type} is not valid for this TestOutcome")
105105

@@ -111,8 +111,8 @@ def apply(self, res: CausalTestResult) -> bool:
111111
if res.ci_valid() and not super().apply(res):
112112
return False
113113
if res.test_value.type in {"ate", "coefficient"}:
114-
return res.test_value.value < 0
114+
return bool(res.test_value.value < 0)
115115
if res.test_value.type == "risk_ratio":
116-
return res.test_value.value < 1
116+
return bool(res.test_value.value < 1)
117117
# Dead code but necessary for pylint
118118
raise ValueError(f"Test Value type {res.test_value.type} is not valid for this TestOutcome")

0 commit comments

Comments
 (0)