1
1
import unittest
2
+ import pandas as pd
2
3
from causal_testing .testing .causal_test_outcome import ExactValue , SomeEffect , Positive , Negative , NoEffect
3
4
from causal_testing .testing .causal_test_result import CausalTestResult , TestValue
4
5
from causal_testing .testing .estimators import LinearRegressionEstimator
@@ -69,7 +70,7 @@ def test_empty_adjustment_set(self):
69
70
)
70
71
71
72
def test_Positive_ate_pass (self ):
72
- test_value = TestValue (type = "ate" , value = 5.05 )
73
+ test_value = TestValue (type = "ate" , value = pd . Series ( 5.05 ) )
73
74
ctr = CausalTestResult (
74
75
estimator = self .estimator ,
75
76
test_value = test_value ,
@@ -80,7 +81,7 @@ def test_Positive_ate_pass(self):
80
81
self .assertTrue (ev .apply (ctr ))
81
82
82
83
def test_Positive_risk_ratio_pass (self ):
83
- test_value = TestValue (type = "risk_ratio" , value = 2 )
84
+ test_value = TestValue (type = "risk_ratio" , value = pd . Series ( 2 ) )
84
85
ctr = CausalTestResult (
85
86
estimator = self .estimator ,
86
87
test_value = test_value ,
@@ -91,7 +92,7 @@ def test_Positive_risk_ratio_pass(self):
91
92
self .assertTrue (ev .apply (ctr ))
92
93
93
94
def test_Positive_fail (self ):
94
- test_value = TestValue (type = "ate" , value = 0 )
95
+ test_value = TestValue (type = "ate" , value = pd . Series ( 0 ) )
95
96
ctr = CausalTestResult (
96
97
estimator = self .estimator ,
97
98
test_value = test_value ,
@@ -102,7 +103,7 @@ def test_Positive_fail(self):
102
103
self .assertFalse (ev .apply (ctr ))
103
104
104
105
def test_Positive_fail_ci (self ):
105
- test_value = TestValue (type = "ate" , value = 0 )
106
+ test_value = TestValue (type = "ate" , value = pd . Series ( 0 ) )
106
107
ctr = CausalTestResult (
107
108
estimator = self .estimator ,
108
109
test_value = test_value ,
@@ -113,7 +114,7 @@ def test_Positive_fail_ci(self):
113
114
self .assertFalse (ev .apply (ctr ))
114
115
115
116
def test_Negative_ate_pass (self ):
116
- test_value = TestValue (type = "ate" , value = - 5.05 )
117
+ test_value = TestValue (type = "ate" , value = pd . Series ( - 5.05 ) )
117
118
ctr = CausalTestResult (
118
119
estimator = self .estimator ,
119
120
test_value = test_value ,
@@ -124,7 +125,7 @@ def test_Negative_ate_pass(self):
124
125
self .assertTrue (ev .apply (ctr ))
125
126
126
127
def test_Negative_risk_ratio_pass (self ):
127
- test_value = TestValue (type = "risk_ratio" , value = 0.2 )
128
+ test_value = TestValue (type = "risk_ratio" , value = pd . Series ( 0.2 ) )
128
129
ctr = CausalTestResult (
129
130
estimator = self .estimator ,
130
131
test_value = test_value ,
@@ -135,7 +136,7 @@ def test_Negative_risk_ratio_pass(self):
135
136
self .assertTrue (ev .apply (ctr ))
136
137
137
138
def test_Negative_fail (self ):
138
- test_value = TestValue (type = "ate" , value = 0 )
139
+ test_value = TestValue (type = "ate" , value = pd . Series ( 0 ) )
139
140
ctr = CausalTestResult (
140
141
estimator = self .estimator ,
141
142
test_value = test_value ,
@@ -146,7 +147,7 @@ def test_Negative_fail(self):
146
147
self .assertFalse (ev .apply (ctr ))
147
148
148
149
def test_Negative_fail_ci (self ):
149
- test_value = TestValue (type = "ate" , value = 0 )
150
+ test_value = TestValue (type = "ate" , value = pd . Series ( 0 ) )
150
151
ctr = CausalTestResult (
151
152
estimator = self .estimator ,
152
153
test_value = test_value ,
@@ -157,7 +158,7 @@ def test_Negative_fail_ci(self):
157
158
self .assertFalse (ev .apply (ctr ))
158
159
159
160
def test_exactValue_pass (self ):
160
- test_value = TestValue (type = "ate" , value = 5.05 )
161
+ test_value = TestValue (type = "ate" , value = pd . Series ( 5.05 ) )
161
162
ctr = CausalTestResult (
162
163
estimator = self .estimator ,
163
164
test_value = test_value ,
@@ -168,7 +169,7 @@ def test_exactValue_pass(self):
168
169
self .assertTrue (ev .apply (ctr ))
169
170
170
171
def test_exactValue_pass_ci (self ):
171
- test_value = TestValue (type = "ate" , value = 5.05 )
172
+ test_value = TestValue (type = "ate" , value = pd . Series ( 5.05 ) )
172
173
ctr = CausalTestResult (
173
174
estimator = self .estimator ,
174
175
test_value = test_value ,
@@ -179,7 +180,7 @@ def test_exactValue_pass_ci(self):
179
180
self .assertTrue (ev .apply (ctr ))
180
181
181
182
def test_exactValue_fail (self ):
182
- test_value = TestValue (type = "ate" , value = 0 )
183
+ test_value = TestValue (type = "ate" , value = pd . Series ( 0 ) )
183
184
ctr = CausalTestResult (
184
185
estimator = self .estimator ,
185
186
test_value = test_value ,
@@ -190,7 +191,7 @@ def test_exactValue_fail(self):
190
191
self .assertFalse (ev .apply (ctr ))
191
192
192
193
def test_invalid (self ):
193
- test_value = TestValue (type = "invalid" , value = 5.05 )
194
+ test_value = TestValue (type = "invalid" , value = pd . Series ( 5.05 ) )
194
195
ctr = CausalTestResult (
195
196
estimator = self .estimator ,
196
197
test_value = test_value ,
@@ -207,7 +208,7 @@ def test_invalid(self):
207
208
Negative ().apply (ctr )
208
209
209
210
def test_someEffect_pass_coefficient (self ):
210
- test_value = TestValue (type = "coefficient" , value = 5.05 )
211
+ test_value = TestValue (type = "coefficient" , value = pd . Series ( 5.05 ) )
211
212
ctr = CausalTestResult (
212
213
estimator = self .estimator ,
213
214
test_value = test_value ,
@@ -218,7 +219,7 @@ def test_someEffect_pass_coefficient(self):
218
219
self .assertFalse (NoEffect ().apply (ctr ))
219
220
220
221
def test_someEffect_pass_ate (self ):
221
- test_value = TestValue (type = "ate" , value = 5.05 )
222
+ test_value = TestValue (type = "ate" , value = pd . Series ( 5.05 ) )
222
223
ctr = CausalTestResult (
223
224
estimator = self .estimator ,
224
225
test_value = test_value ,
@@ -229,7 +230,7 @@ def test_someEffect_pass_ate(self):
229
230
self .assertFalse (NoEffect ().apply (ctr ))
230
231
231
232
def test_someEffect_pass_rr (self ):
232
- test_value = TestValue (type = "risk_ratio" , value = 5.05 )
233
+ test_value = TestValue (type = "risk_ratio" , value = pd . Series ( 5.05 ) )
233
234
ctr = CausalTestResult (
234
235
estimator = self .estimator ,
235
236
test_value = test_value ,
@@ -240,7 +241,7 @@ def test_someEffect_pass_rr(self):
240
241
self .assertFalse (NoEffect ().apply (ctr ))
241
242
242
243
def test_someEffect_fail (self ):
243
- test_value = TestValue (type = "ate" , value = 0 )
244
+ test_value = TestValue (type = "ate" , value = pd . Series ( 0 ) )
244
245
ctr = CausalTestResult (
245
246
estimator = self .estimator ,
246
247
test_value = test_value ,
0 commit comments