Author: tlinnet Date: Wed Dec 3 18:38:21 2014 New Revision: 26931 URL: http://svn.gna.org/viewcvs/relax?rev=26931&view=rev Log: Added unit test for testing storing filelists in cdp. Task #7873 (https://gna.org/task/index.php?7873): Write wrapper function to nmrglue, to read .ft2 files and process them. Homepage: http://www.nmrglue.com/ Link to nmrglue discussion: https://groups.google.com/forum/#!forum/nmrglue-discuss The code is develop at Github: https://github.com/jjhelmus/nmrglue/ Documentation: http://nmrglue.readthedocs.org/en/latest/index.html Modified: branches/nmrglue/test_suite/unit_tests/_pipe_control/test_io.py Modified: branches/nmrglue/test_suite/unit_tests/_pipe_control/test_io.py URL: http://svn.gna.org/viewcvs/relax/branches/nmrglue/test_suite/unit_tests/_pipe_control/test_io.py?rev=26931&r1=26930&r2=26931&view=diff ============================================================================== --- branches/nmrglue/test_suite/unit_tests/_pipe_control/test_io.py (original) +++ branches/nmrglue/test_suite/unit_tests/_pipe_control/test_io.py Wed Dec 3 18:38:21 2014 @@ -20,9 +20,13 @@ # # ############################################################################### +# Python module imports. +from os import sep + # relax module imports. from data_store import Relax_data_store; ds = Relax_data_store() from pipe_control import io +from status import Status; status = Status() from test_suite.unit_tests.base_classes import UnitTestCase @@ -49,3 +53,24 @@ # Test data pipe has the object 'io_basename' and that its value is the expected list. self.assertEqual(cdp.io_basename[io_id], base_name) + + + def test_file_list(self): + """Test storing file list to current pipe. + + The function tested is pipe_control.file_list(). + """ + + # Define base path to files. + base_path = status.install_path + sep+'test_suite'+sep+'shared_data'+sep+'dispersion'+sep+'repeated_analysis'+sep+'SOD1' + + # Define folder to all ft files. + ft2_folder_1 = base_path +sep+ 'cpmg_disp_sod1d90a_060518' +sep+ 'cpmg_disp_sod1d90a_060518_normal.fid' +sep+ 'ft2_data' + + # Get the file list matching a glob pattern. + ft2_glob_pat = '128_*_FT.ft2' + io.file_list(glob=ft2_glob_pat, dir=ft2_folder_1, id=None) + + self.assertEqual(cdp.io_basename[ft2_glob_pat], ['128_0_FT.ft2', '128_1_FT.ft2']) + self.assertEqual(cdp.io_file_root[ft2_glob_pat], ['128_0_FT', '128_1_FT']) + self.assertEqual(cdp.io_dir[ft2_glob_pat], ft2_folder_1)