Skip to content

Commit f50af43

Browse files
Add assert
1 parent 47f37ce commit f50af43

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tests/json_front_tests/test_json_class.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ def test_abstract_test_case_generation(self):
9595

9696
def test_execute_concrete_test(self):
9797
self.json_class.setup()
98+
dag_string = "digraph G { test_input -> B; B -> C; test_output -> test_input; test_output -> C}"
99+
setup_dag_file(self.dag_path, dag_string)
98100
effects = {"NoEffect": NoEffect()}
99101
mutates = {
100102
"Increase": lambda x: self.json_class.modelling_scenario.treatment_variables[x].z3 >
@@ -113,7 +115,10 @@ def test_execute_concrete_test(self):
113115
estimators = {"LinearRegressionEstimator": LinearRegressionEstimator}
114116
abstract_test_case = self.json_class._create_abstract_test_case(example_test, mutates, effects)
115117
concrete_tests, dummy = abstract_test_case.generate_concrete_tests(5, 0.5)
116-
self.json_class._execute_tests(concrete_tests, estimators, example_test, False)
118+
119+
#This scenario produces 5 errors
120+
failures = self.json_class._execute_tests(concrete_tests, estimators, example_test, False)
121+
self.assertEqual(failures, 5)
117122

118123
def tearDown(self) -> None:
119124
#remove_temp_dir_if_existent()
@@ -151,14 +156,15 @@ def setup_data_file(data_path):
151156
writer.writerow(header)
152157
writer.writerow(data)
153158

154-
def setup_dag_file(dag_path):
155-
dag_dot = """digraph G { test_input -> B; B -> C; test_output -> test_input; test_output -> C}"""
159+
def setup_dag_file(dag_path, dag_string):
160+
dag_dot = dag_string
156161
with open(dag_path, "w") as f:
157162
f.write(dag_dot)
158163
f.close()
159164

160165

161166
def setup_files(json_path, data_path, dag_path):
167+
dag_string = "digraph G { test_input -> B; B -> C; test_output -> test_input; test_output -> C}"
162168
setup_data_file(data_path)
163169
setup_json_file(json_path)
164-
setup_dag_file(dag_path)
170+
setup_dag_file(dag_path, dag_string)

0 commit comments

Comments
 (0)