Skip to content

Commit 7bdd4b6

Browse files
committed
tests(wE): update tests for new wE Sorient outputs and optional parallel flag
1 parent ce77cef commit 7bdd4b6

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

‎tests/unit/CodeEntropy/entropy/test_water_entropy.py‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_water_entropy_calls_solver_and_logs_components():
2424
args = SimpleNamespace(temperature=298.0)
2525
reporter = MagicMock()
2626

27-
Sorient_dict = {1: {"WAT": [3.0, 5]}}
27+
Sorient_dict = {1: {"WAT": {"Sorient_Nw_ave": 3.0, "tot_count": 5}}}
2828

2929
covariances = SimpleNamespace(counts={(7, "WAT"): 2})
3030

@@ -41,7 +41,9 @@ def test_water_entropy_calls_solver_and_logs_components():
4141

4242
universe = _make_fake_universe_with_water()
4343

44-
we.calculate_and_log(universe=universe, start=0, end=10, step=1, group_id=9)
44+
we.calculate_and_log(
45+
universe=universe, start=0, end=10, step=1, parallel=True, group_id=9
46+
)
4547

4648
solver.assert_called_once()
4749

@@ -79,7 +81,9 @@ def test_water_entropy_handles_empty_solver_results_gracefully():
7981

8082
universe = _make_fake_universe_with_water()
8183

82-
we.calculate_and_log(universe=universe, start=0, end=10, step=1, group_id=1)
84+
we.calculate_and_log(
85+
universe=universe, start=0, end=10, step=1, parallel=True, group_id=1
86+
)
8387

8488
reporter.add_residue_data.assert_not_called()
8589
reporter.add_group_label.assert_called_once()
@@ -113,7 +117,9 @@ def test_water_group_label_handles_multiple_water_resnames():
113117

114118
universe.select_atoms.return_value = water_selection
115119

116-
we.calculate_and_log(universe=universe, start=0, end=10, step=1, group_id=1)
120+
we.calculate_and_log(
121+
universe=universe, start=0, end=10, step=1, parallel=True, group_id=1
122+
)
117123

118124
reporter.add_group_label.assert_called_once()
119125

@@ -144,7 +150,7 @@ def test_log_group_label_defaults_to_WAT_when_no_residue_names_match():
144150
water_selection.atoms = [1, 2, 3]
145151
universe.select_atoms.return_value = water_selection
146152

147-
Sorient_dict = {1: {"TIP3": [1.0, 1]}}
153+
Sorient_dict = {1: {"TIP3": {"Sorient_Nw_ave": 1.0, "tot_count": 1}}}
148154

149155
we._log_group_label(universe, Sorient_dict, group_id=7)
150156

‎tests/unit/CodeEntropy/entropy/test_workflow.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def test_execute_water_entropy_branch_calls_water_entropy_solver():
8080
step=1,
8181
grouping="molecules",
8282
water_entropy=True,
83+
water_entropy_parallel=True,
8384
selection_string="all",
8485
output_file="out.json",
8586
)
@@ -291,6 +292,7 @@ def test_compute_water_entropy_updates_selection_string_and_calls_internal_metho
291292
args = SimpleNamespace(
292293
selection_string="all",
293294
water_entropy=True,
295+
water_entropy_parallel=True,
294296
temperature=298.0,
295297
)
296298
wf = EntropyWorkflow(
@@ -317,6 +319,7 @@ def test_compute_water_entropy_updates_selection_string_and_calls_internal_metho
317319
start=0,
318320
end=5,
319321
step=1,
322+
parallel=True,
320323
group_id=9,
321324
)
322325
assert wf._args.selection_string == "not water"
@@ -428,6 +431,7 @@ def test_compute_water_entropy_instantiates_waterentropy_and_updates_selection_s
428431
args = SimpleNamespace(
429432
selection_string="all",
430433
water_entropy=True,
434+
water_entropy_parallel=True,
431435
temperature=298.0,
432436
)
433437
universe = MagicMock()
@@ -458,6 +462,7 @@ def test_compute_water_entropy_instantiates_waterentropy_and_updates_selection_s
458462
start=0,
459463
end=5,
460464
step=1,
465+
parallel=True,
461466
group_id=9,
462467
)
463468
assert args.selection_string == "not water"
@@ -771,6 +776,7 @@ def test_compute_water_entropy_appends_not_water_to_existing_selection():
771776
args = SimpleNamespace(
772777
selection_string="protein",
773778
water_entropy=True,
779+
water_entropy_parallel=True,
774780
temperature=298.0,
775781
output_file="out.json",
776782
)
@@ -789,6 +795,7 @@ def test_compute_water_entropy_appends_not_water_to_existing_selection():
789795
start=0,
790796
end=5,
791797
step=1,
798+
parallel=True,
792799
group_id=9,
793800
)
794801
assert args.selection_string == "protein and not water"

0 commit comments

Comments
 (0)