Skip to content

Commit 3841f8c

Browse files
committed
Black and pylint
1 parent 651a358 commit 3841f8c

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

causal_testing/json_front/json_class.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,9 @@ def _execute_test_case(self, causal_test_case: CausalTestCase, test: Iterable[Ma
225225
logger.warning(" FAILED- expected %s, got %s", causal_test_case.expected_causal_effect, result_string)
226226
return failed
227227

228-
def _setup_test(self, causal_test_case: CausalTestCase, test: Mapping, conditions: list[str]=None) -> tuple[CausalTestEngine, Estimator]:
228+
def _setup_test(
229+
self, causal_test_case: CausalTestCase, test: Mapping, conditions: list[str] = None
230+
) -> tuple[CausalTestEngine, Estimator]:
229231
"""Create the necessary inputs for a single test case
230232
:param causal_test_case: The concrete test case to be executed
231233
:param test: Single JSON test definition stored in a mapping (dict)

causal_testing/specification/causal_dag.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,10 @@ def identification(self, base_test_case: BaseTestCase):
521521
minimal_adjustment_set = min(minimal_adjustment_sets, key=len)
522522
return minimal_adjustment_set
523523

524-
def to_dot(self):
524+
def to_dot(self) -> str:
525+
"""Return a string of the DOT representation of the causal DAG.
526+
:return DOT string of the DAG.
527+
"""
525528
return str(nx.nx_pydot.to_pydot(self.graph))
526529

527530
def __str__(self):

tests/json_front_tests/test_json_class.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,22 +197,22 @@ def test_formula_in_json_test(self):
197197
"effect_modifiers": [],
198198
"expectedEffect": {"test_output": "Positive"},
199199
"skip": False,
200-
"formula": "test_output ~ test_input"
200+
"formula": "test_output ~ test_input",
201201
}
202202
]
203203
}
204204
self.json_class.test_plan = example_test
205205
effects = {"Positive": Positive()}
206206
mutates = {
207207
"Increase": lambda x: self.json_class.scenario.treatment_variables[x].z3
208-
> self.json_class.scenario.variables[x].z3
208+
> self.json_class.scenario.variables[x].z3
209209
}
210210
estimators = {"LinearRegressionEstimator": LinearRegressionEstimator}
211211

212212
self.json_class.generate_tests(effects, mutates, estimators, False)
213-
with open("temp_out.txt", 'r') as reader:
213+
with open("temp_out.txt", "r") as reader:
214214
temp_out = reader.readlines()
215-
self.assertIn("test_output ~ test_input", ''.join(temp_out))
215+
self.assertIn("test_output ~ test_input", "".join(temp_out))
216216

217217
def tearDown(self) -> None:
218218
remove_temp_dir_if_existent()

0 commit comments

Comments
 (0)