def test_iter_pdb(): """Tests that pdb files with multiple frames are read correctly.""" with open(local("test.pos_0.pdb"), "r") as f: for num, (atoms, cell) in enumerate(io_pdb.iter_pdb(f)): assert(len(atoms) == 3) assert_equal(pos*(num+1), atoms.q)
def test_print_xyz(): """Tests that xyz files are printed correctly.""" with open(local("test.pos_0.pdb"), "r") as f: with open(local("test.pos_1.pdb"), "w") as out: for num, (atoms, cell) in enumerate(io_pdb.iter_pdb(f)): assert(len(atoms) == 3) assert_equal(pos*(num+1), atoms.q) io_pdb.print_pdb(atoms, Cell(h=np.identity(3, float)), filedesc=out) assert(filecmp.cmp(local("test.pos_0.pdb"), local("test.pos_1.pdb"))) os.unlink(local("test.pos_1.pdb"))