Skip to content

Commit 1846728

Browse files
committed
Fixed the tests
1 parent e608219 commit 1846728

4 files changed

Lines changed: 11 additions & 14 deletions

File tree

tests/discovery_tests/test_abstract_discovery.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,21 +195,21 @@ def test_evaluate_tests(self):
195195
"effect": "positive",
196196
},
197197
{
198-
"result": TestResult.INESTIMABLE,
198+
"result": TestResult.PASS,
199199
"expected_effect": "NoEffect",
200200
"treatment": "large_gauge",
201201
"outcome": "length_in",
202-
"effect": None,
202+
"effect": "positive",
203203
},
204204
{
205-
"result": TestResult.INESTIMABLE,
205+
"result": TestResult.PASS,
206206
"expected_effect": "NoEffect",
207207
"treatment": "length_in",
208208
"outcome": "color",
209209
"effect": None,
210210
},
211211
{
212-
"result": TestResult.INESTIMABLE,
212+
"result": TestResult.PASS,
213213
"expected_effect": "NoEffect",
214214
"treatment": "color",
215215
"outcome": "length_in",
@@ -223,7 +223,7 @@ def test_evaluate_tests(self):
223223
"effect": "negative",
224224
},
225225
{
226-
"result": TestResult.INESTIMABLE,
226+
"result": TestResult.PASS,
227227
"expected_effect": "NoEffect",
228228
"treatment": "large_gauge",
229229
"outcome": "color",
@@ -251,7 +251,7 @@ def test_evaluate_tests(self):
251251
"effect": None,
252252
},
253253
{
254-
"result": TestResult.INESTIMABLE,
254+
"result": TestResult.PASS,
255255
"expected_effect": "NoEffect",
256256
"treatment": "completed",
257257
"outcome": "color",

tests/discovery_tests/test_hill_climber_discovery.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,8 @@ def test_evaluate_fitness(self):
106106

107107
hill_climber = HillClimberDiscovery(scarf_df)
108108
fitness_values, problem_edges = hill_climber.evaluate_fitness(dag)
109-
expected_fitness_values = (1.5, -2, -2.5)
109+
expected_fitness_values = (4, -2, 0)
110110
expected_problem_edges = [
111-
("length_in", "color"),
112-
("color", "length_in"),
113111
("length_in", "completed"),
114112
("large_gauge", "completed"),
115113
]

tests/discovery_tests/test_nsga_discovery.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,10 @@ def test_multiobjective_fitness(self):
3030
dag.add_edges_from([("length_in", "completed"), ("large_gauge", "completed")])
3131
nsga = NSGADiscovery(scarf_df)
3232

33+
expected = np.array([2, 2, 2, 0.0, 0.0, 2])
34+
multiobjective_fitness = nsga.multi_objective_fitness(None, nsga.causal_dag_to_binary_string(dag), None)
3335
self.assertTrue(
34-
np.array_equal(
35-
nsga.multi_objective_fitness(None, nsga.causal_dag_to_binary_string(dag), None),
36-
np.array([1.5, 1.5, 1.0, 0.0, 0.0, 1.5]),
37-
)
36+
np.array_equal(multiobjective_fitness, expected), f"Arrays differ: {expected} != {multiobjective_fitness}"
3837
)
3938

4039
def test_discovery_edges(self):

tests/main_tests/test_main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def test_create_test_case_invalid_estimator(self):
148148
with self.assertRaises(ValueError) as e:
149149
framework.create_causal_test({"estimator": "InvalidEstimator"}, None)
150150
self.assertEqual(
151-
f"Unsupported estimator InvalidEstimator. Supported: ['CubicSplineEstimator', 'IPCWEstimator', 'InstrumentalVariableEstimator', 'LinearRegressionEstimator', 'LogisticRegressionEstimator']. "
151+
f"Unsupported estimator InvalidEstimator. Supported: ['CubicSplineEstimator', 'IPCWEstimator', 'InstrumentalVariableEstimator', 'LinearRegressionEstimator', 'LogisticRegressionEstimator', 'MultinomialRegressionEstimator']. "
152152
"If you have implemented a custom estimator, you will need to add this to your entrypoints via your "
153153
"pyproject.toml file.",
154154
str(e.exception),

0 commit comments

Comments
 (0)