Author: bugman Date: Sun Jan 11 12:20:07 2009 New Revision: 8371 URL: http://svn.gna.org/viewcvs/relax?rev=8371&view=rev Log: Created a system test for the writing and reading of a BRMB STAR formatted file. Added: branches/bmrb/test_suite/system_tests/bmrb.py Modified: branches/bmrb/test_suite/system_tests/__init__.py Modified: branches/bmrb/test_suite/system_tests/__init__.py URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/test_suite/system_tests/__init__.py?rev=8371&r1=8370&r2=8371&view=diff ============================================================================== --- branches/bmrb/test_suite/system_tests/__init__.py (original) +++ branches/bmrb/test_suite/system_tests/__init__.py Sun Jan 11 12:20:07 2009 @@ -32,6 +32,7 @@ # relax system/functional test module imports. from angles import Angles +from bmrb import Bmrb from consistency_tests import Ct from dasha import Dasha from diffusion_tensor import Diffusion_tensor @@ -55,6 +56,7 @@ __all__ = ['angles', + 'brmb', 'consistency_tests', 'dasha' 'diffusion_tensor', @@ -96,6 +98,7 @@ # Create an array of test suites (add your new TestCase classes here). suite_array = [] suite_array.append(TestLoader().loadTestsFromTestCase(Angles)) + suite_array.append(TestLoader().loadTestsFromTestCase(Bmrb)) suite_array.append(TestLoader().loadTestsFromTestCase(Ct)) suite_array.append(TestLoader().loadTestsFromTestCase(Dasha)) suite_array.append(TestLoader().loadTestsFromTestCase(Diffusion_tensor)) Added: branches/bmrb/test_suite/system_tests/bmrb.py URL: http://svn.gna.org/viewcvs/relax/branches/bmrb/test_suite/system_tests/bmrb.py?rev=8371&view=auto ============================================================================== --- branches/bmrb/test_suite/system_tests/bmrb.py (added) +++ branches/bmrb/test_suite/system_tests/bmrb.py Sun Jan 11 12:20:07 2009 @@ -1,0 +1,74 @@ +############################################################################### +# # +# Copyright (C) 2008 Edward d'Auvergne # +# # +# This file is part of the program relax. # +# # +# relax is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# relax is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with relax; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +############################################################################### + +# Python module imports. +from os import remove +import sys +from tempfile import mktemp +from unittest import TestCase + +# relax module imports. +from data import Relax_data_store; ds = Relax_data_store() + + +class Bmrb(TestCase): + """TestCase class for functional tests of the reading and writing of BMRB STAR formatted files.""" + + def setUp(self): + """Common set up for these system tests.""" + + # Create a temporary file name. + self.tmpfile = mktemp() + + + def tearDown(self): + """Reset the relax data storage object.""" + + # Reset the relax data storage object. + ds.__reset__() + + # Delete the temporary file. + try: + remove(self.tmpfile) + except OSError: + pass + + + def test_rw_bmrb_model_free(self): + """Write and then read a BRMB STAR formatted file containing model-free results.""" + + # Path of the files. + path = sys.path[-1] + '/test_suite/shared_data/model_free/OMP' + + # Read the relax results file. + self.relax.interpreter._Pipe.create('results', 'mf') + self.relax.interpreter._Results.read(file='final_results_trunc_1.3', dir=path) + + # Write the BMRB STAR formatted file. + self.relax.interpreter._Bmrb.write(file=self.tmpfile, force=True) + + # Create a new data pipe for reading the data back in. + self.relax.interpreter._Pipe.create('bmrb', 'mf') + + # Read the BMRB STAR formatted file. + self.relax.interpreter._Bmrb.read(file=self.tmpfile) +