|
3 | 3 | from statistics import StatisticsError
|
4 | 4 | import scipy
|
5 | 5 |
|
6 |
| - |
7 | 6 | from causal_testing.testing.estimators import LinearRegressionEstimator
|
8 | 7 | from causal_testing.testing.causal_test_outcome import NoEffect, Positive
|
9 | 8 | from tests.test_helpers import remove_temp_dir_if_existent
|
@@ -99,7 +98,7 @@ def test_f_flag(self):
|
99 | 98 | effects = {"NoEffect": NoEffect()}
|
100 | 99 | mutates = {
|
101 | 100 | "Increase": lambda x: self.json_class.scenario.treatment_variables[x].z3
|
102 |
| - > self.json_class.scenario.variables[x].z3 |
| 101 | + > self.json_class.scenario.variables[x].z3 |
103 | 102 | }
|
104 | 103 | estimators = {"LinearRegressionEstimator": LinearRegressionEstimator}
|
105 | 104 | with self.assertRaises(StatisticsError):
|
@@ -148,7 +147,7 @@ def test_run_json_tests_from_json(self):
|
148 | 147 | effects = {"NoEffect": NoEffect()}
|
149 | 148 | mutates = {
|
150 | 149 | "Increase": lambda x: self.json_class.scenario.treatment_variables[x].z3
|
151 |
| - > self.json_class.scenario.variables[x].z3 |
| 150 | + > self.json_class.scenario.variables[x].z3 |
152 | 151 | }
|
153 | 152 | estimators = {"LinearRegressionEstimator": LinearRegressionEstimator}
|
154 | 153 |
|
@@ -178,7 +177,7 @@ def test_generate_tests_from_json_no_dist(self):
|
178 | 177 | effects = {"NoEffect": NoEffect()}
|
179 | 178 | mutates = {
|
180 | 179 | "Increase": lambda x: self.json_class.scenario.treatment_variables[x].z3
|
181 |
| - > self.json_class.scenario.variables[x].z3 |
| 180 | + > self.json_class.scenario.variables[x].z3 |
182 | 181 | }
|
183 | 182 | estimators = {"LinearRegressionEstimator": LinearRegressionEstimator}
|
184 | 183 |
|
@@ -208,7 +207,7 @@ def test_formula_in_json_test(self):
|
208 | 207 | effects = {"Positive": Positive()}
|
209 | 208 | mutates = {
|
210 | 209 | "Increase": lambda x: self.json_class.scenario.treatment_variables[x].z3
|
211 |
| - > self.json_class.scenario.variables[x].z3 |
| 210 | + > self.json_class.scenario.variables[x].z3 |
212 | 211 | }
|
213 | 212 | estimators = {"LinearRegressionEstimator": LinearRegressionEstimator}
|
214 | 213 |
|
@@ -241,6 +240,26 @@ def test_run_concrete_json_testcase(self):
|
241 | 240 | temp_out = reader.readlines()
|
242 | 241 | self.assertIn("FAILED", temp_out[-1])
|
243 | 242 |
|
| 243 | + def test_no_data_provided(self): |
| 244 | + example_test = { |
| 245 | + "tests": [ |
| 246 | + { |
| 247 | + "name": "test1", |
| 248 | + "mutations": {"test_input": "Increase"}, |
| 249 | + "estimator": "LinearRegressionEstimator", |
| 250 | + "estimate_type": "ate", |
| 251 | + "effect_modifiers": [], |
| 252 | + "expected_effect": {"test_output": "NoEffect"}, |
| 253 | + "skip": False, |
| 254 | + } |
| 255 | + ] |
| 256 | + } |
| 257 | + json_class = JsonUtility("temp_out.txt", True) |
| 258 | + json_class.set_paths(self.json_path, self.dag_path) |
| 259 | + json_class.setup(self.scenario) |
| 260 | + |
| 261 | + self.assertRaises(ValueError) |
| 262 | + |
244 | 263 | def tearDown(self) -> None:
|
245 | 264 | remove_temp_dir_if_existent()
|
246 | 265 |
|
|
0 commit comments