Skip to content

Commit 14e0b7b

Browse files
Tests now use new test result layout
1 parent b90a018 commit 14e0b7b

File tree

2 files changed

+13
-26
lines changed

2 files changed

+13
-26
lines changed

examples/poisson/run_causal_tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ def add_modelling_assumptions(self, estimation_model: Estimator):
160160
if __name__ == "__main__":
161161
args = MyJsonUtility.get_args()
162162
json_utility = MyJsonUtility(args.log_path) # Create an instance of the extended JsonUtility class
163-
json_utility.set_path(args.json_path, args.dag_path,
164-
args.data_path) # Set the path to the data.csv, dag.dot and causal_tests.json file
163+
json_utility.set_paths(args.json_path, args.dag_path,
164+
args.data_path) # Set the path to the data.csv, dag.dot and causal_tests.json file
165165

166166
# Load the Causal Variables into the JsonUtility class ready to be used in the tests
167167
json_utility.set_variables(inputs, outputs, metas)

tests/testing_tests/test_causal_test_outcome.py

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
import unittest
22
from causal_testing.testing.causal_test_outcome import ExactValue, SomeEffect
33
from causal_testing.testing.causal_test_result import CausalTestResult, TestValue
4-
4+
from causal_testing.testing.estimators import LinearRegressionEstimator
55

66
class TestCausalTestOutcome(unittest.TestCase):
77
"""Test the TestCausalTestOutcome basic methods."""
8-
9-
def test_empty_adjustment_set(self):
10-
ctr = CausalTestResult(
8+
def setUp(self) -> None:
9+
self.estimator = LinearRegressionEstimator(
1110
treatment="A",
1211
outcome="A",
1312
treatment_value=1,
1413
control_value=0,
1514
adjustment_set={},
15+
)
16+
def test_empty_adjustment_set(self):
17+
ctr = CausalTestResult(
18+
estimator=self.estimator,
1619
test_value=0,
1720
confidence_intervals=None,
1821
effect_modifier_configuration=None,
@@ -24,11 +27,7 @@ def test_empty_adjustment_set(self):
2427
def test_exactValue_pass(self):
2528
test_value = TestValue(type="ate", value=5.05)
2629
ctr = CausalTestResult(
27-
treatment="A",
28-
outcome="A",
29-
treatment_value=1,
30-
control_value=0,
31-
adjustment_set={},
30+
estimator=self.estimator,
3231
test_value=test_value,
3332
confidence_intervals=None,
3433
effect_modifier_configuration=None,
@@ -39,11 +38,7 @@ def test_exactValue_pass(self):
3938
def test_exactValue_fail(self):
4039
test_value = TestValue(type="ate", value=0)
4140
ctr = CausalTestResult(
42-
treatment="A",
43-
outcome="A",
44-
treatment_value=1,
45-
control_value=0,
46-
adjustment_set={},
41+
estimator=self.estimator,
4742
test_value=test_value,
4843
confidence_intervals=None,
4944
effect_modifier_configuration=None,
@@ -54,11 +49,7 @@ def test_exactValue_fail(self):
5449
def test_someEffect_pass(self):
5550
test_value = TestValue(type="ate", value=5.05)
5651
ctr = CausalTestResult(
57-
treatment="A",
58-
outcome="A",
59-
treatment_value=1,
60-
control_value=0,
61-
adjustment_set={},
52+
estimator=self.estimator,
6253
test_value=test_value,
6354
confidence_intervals=[4.8, 6.7],
6455
effect_modifier_configuration=None,
@@ -69,11 +60,7 @@ def test_someEffect_pass(self):
6960
def test_someEffect_fail(self):
7061
test_value = TestValue(type="ate", value=0)
7162
ctr = CausalTestResult(
72-
treatment="A",
73-
outcome="A",
74-
treatment_value=1,
75-
control_value=0,
76-
adjustment_set={},
63+
estimator=self.estimator,
7764
test_value=test_value,
7865
confidence_intervals=[-0.1, 0.2],
7966
effect_modifier_configuration=None,

0 commit comments

Comments
 (0)