Commit 197eac74 authored by Rafal P. Wiewiora's avatar Rafal P. Wiewiora
Browse files

rearrange TestPdbFile.py

parent 58d0c548
......@@ -70,15 +70,6 @@ class TestPdbFile(unittest.TestCase):
pdb = PDBFile(open('systems/triclinic.pdb', 'rb'))
self.assertEqual(len(pdb.positions), 8)
def assertVecAlmostEqual(self, p1, p2, tol=1e-7):
unit = p1.unit
p1 = p1.value_in_unit(unit)
p2 = p2.value_in_unit(unit)
scale = max(1.0, norm(p1),)
for i in range(3):
diff = abs(p1[i]-p2[i])/scale
self.assertTrue(diff < tol)
def test_ExtraParticles(self):
"""Test reading, and writing and re-reading of a file containing extra particle atoms."""
pdb = PDBFile('systems/tip5p.pdb')
......@@ -94,5 +85,15 @@ class TestPdbFile(unittest.TestCase):
self.assertEqual(None, atom.element)
def assertVecAlmostEqual(self, p1, p2, tol=1e-7):
unit = p1.unit
p1 = p1.value_in_unit(unit)
p2 = p2.value_in_unit(unit)
scale = max(1.0, norm(p1),)
for i in range(3):
diff = abs(p1[i]-p2[i])/scale
self.assertTrue(diff < tol)
if __name__ == '__main__':
unittest.main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment