Skip to content

Commit 663d17d

Browse files
author
Fabian Gruenewald
committed
add tests for gen_coords box input usual
1 parent e87a6c3 commit 663d17d

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

polyply/tests/test_gen_coords_logic.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,24 @@ def test_no_positions_generated(tmp_path, monkeypatch):
4747
assert np.all(molecule_out.nodes[node]['position'] ==
4848
molecule_in.nodes[node]['position'])
4949

50-
@pytest.mark.parametrize('box_input, box_ref, density, warning', [
50+
@pytest.mark.parametrize('box_input, box_ref, density, warning, incoords', [
5151
# box from input coordinates
52-
(None, np.array([11.0, 11.0, 11.0]), None, None),
52+
(None, np.array([11.0, 11.0, 11.0]),
53+
None, None, True),
5354
# box from input coordinates overwrites
54-
(np.array([5.0, 5.0, 5.0]), np.array([11.0, 11.0, 11.0]), None, "warn1"),
55+
(np.array([5.0, 5.0, 5.0]), np.array([11.0, 11.0, 11.0]),
56+
None, "warn1", True),
5557
# box from input coordinates and density from CLI
56-
(None, np.array([11.0, 11.0, 11.0]), 1000, "warn2"),
58+
(None, np.array([11.0, 11.0, 11.0]),
59+
1000, "warn2", True),
60+
# box only from CLI
61+
(np.array([8.0, 11.0, 11.0]), np.array([8.0, 11.0, 11.0]),
62+
None, None, False),
63+
# only density
64+
(None, np.array([0.79273, 0.79273, 0.79273]),
65+
1000, None, False),
5766
])
58-
def test_box_input(tmp_path, caplog, box_input, box_ref, density, warning):
67+
def test_box_input(tmp_path, caplog, box_input, box_ref, density, warning, incoords):
5968
"""
6069
Here we test that the correct box is chosen, in case there
6170
are conflicting inputs.
@@ -69,7 +78,12 @@ def test_box_input(tmp_path, caplog, box_input, box_ref, density, warning):
6978
"provided with starting coordinates."),}
7079

7180
top_file = TEST_DATA / "topology_test/system.top"
72-
pos_file = TEST_DATA / "topology_test/complete.gro"
81+
if incoords:
82+
pos_file = TEST_DATA / "topology_test/complete.gro"
83+
else:
84+
# no input coordiante provided
85+
pos_file = None
86+
7387
out_file = tmp_path / "out.gro"
7488

7589
with caplog.at_level(logging.WARNING):

0 commit comments

Comments
 (0)