Skip to content

Commit dbfe5cd

Browse files
Create test case for concrete JSON
1 parent 4ac0e85 commit dbfe5cd

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

tests/json_front_tests/test_json_class.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,31 @@ def test_generate_tests_from_json(self):
127127
temp_out = reader.readlines()
128128
self.assertIn("failed", temp_out[-1])
129129

130+
def test_values_not_mutates(self):
131+
example_test = {
132+
"tests": [
133+
{
134+
"name": "test1",
135+
"treatment_variable": "test_input",
136+
"control_value": 0,
137+
"treatment_value": 1,
138+
"estimator": "LinearRegressionEstimator",
139+
"estimate_type": "ate",
140+
"expectedEffect": {"test_output": "NoEffect"},
141+
"skip": False,
142+
}
143+
]
144+
}
145+
self.json_class.test_plan = example_test
146+
effects = {"NoEffect": NoEffect()}
147+
estimators = {"LinearRegressionEstimator": LinearRegressionEstimator}
148+
149+
self.json_class.run_json_tests(effects, estimators, False)
150+
with open("temp_out.txt", 'r') as reader:
151+
temp_out = reader.readlines()
152+
self.assertIn("failed", temp_out[-1])
130153
def tearDown(self) -> None:
131-
pass
132-
# remove_temp_dir_if_existent()
154+
remove_temp_dir_if_existent()
133155

134156

135157
def populate_example(*args, **kwargs):

0 commit comments

Comments
 (0)