Skip to content

Commit 95769df

Browse files
committed
relax test precision. xtc files don't keep that much precision
1 parent 2a2b1a0 commit 95769df

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

moleculekit/writers.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,21 +1690,21 @@ def test_non_square_box(self):
16901690
mol = Molecule(os.path.join(datadir, "3ptb_dodecahedron.pdb"))
16911691
mol.read(os.path.join(datadir, "output.xtc"))
16921692

1693-
assert np.all(mol.boxangles[0, :] == 120)
1694-
assert np.all(mol.boxangles[1, :] == 120)
1695-
assert np.all(mol.boxangles[2, :] == 90)
1693+
assert np.allclose(mol.boxangles[0, :], 120, atol=1e-2)
1694+
assert np.allclose(mol.boxangles[1, :], 120, atol=1e-2)
1695+
assert np.allclose(mol.boxangles[2, :], 90, atol=1e-2)
16961696
refbox = np.array(
16971697
[[71.419, 69.688385], [71.419, 69.688385], [71.419, 69.688385]],
16981698
dtype=np.float32,
16991699
)
1700-
assert np.array_equal(mol.box[:, :2], refbox)
1700+
assert np.allclose(mol.box[:, :2], refbox, atol=1e-2)
17011701

17021702
with tempfile.TemporaryDirectory() as tmpdir:
17031703
mol.write(os.path.join(tmpdir, "3ptb_dodecahedron.xtc"))
17041704
mol2 = Molecule(os.path.join(tmpdir, "3ptb_dodecahedron.xtc"))
17051705

1706-
assert np.allclose(mol.box, mol2.box, atol=1e-5)
1707-
assert np.allclose(mol.boxangles, mol2.boxangles, atol=1e-5)
1706+
assert np.allclose(mol.box, mol2.box, atol=1e-2)
1707+
assert np.allclose(mol.boxangles, mol2.boxangles, atol=1e-2)
17081708

17091709

17101710
if __name__ == "__main__":

0 commit comments

Comments
 (0)