comparison test/test_library_lookup.py @ 1:071a185c2ced

new tools
author pieter.lukasse@wur.nl
date Fri, 24 Oct 2014 12:52:56 +0200
parents 4b94bb2d381c
children
comparison
equal deleted inserted replaced
0:4b94bb2d381c 1:071a185c2ced
25 def test_create_lookup_table(self): 25 def test_create_lookup_table(self):
26 ''' 26 '''
27 Tests the 'create_lookup_table' function 27 Tests the 'create_lookup_table' function
28 ''' 28 '''
29 column_type = 'Capillary' 29 column_type = 'Capillary'
30 polarity = 'Semi-standard non-polar' 30 polarity = 'Semi-standard non-polar6'
31 lookup_dict = library_lookup.create_lookup_table(self.ri_database, column_type, polarity) 31 lookup_dict = library_lookup.create_lookup_table(self.ri_database, column_type, polarity)
32 self.assertFalse(False in [res[4] == 'Capillary' for res in lookup_dict['4177166']]) 32 self.assertFalse(False in [res[4] == 'Capillary' for res in lookup_dict['4177166']])
33 self.assertEqual(['C51276336', '2,6-Dimethyl-octa-1,7-dien-3,6-diol', 'C10H18O2', 33 self.assertEqual(['C51276336', '2,6-Dimethyl-octa-1,7-dien-3,6-diol', 'C10H18O2',
34 '1277', 'Capillary', 'Semi-standard non-polar', 'DB-5MS', '1', 34 '1277', 'Capillary', 'Semi-standard non-polar', 'DB-5MS', '1',
35 'C51276336_DB-5MS', '', '', ''], lookup_dict['51276336'][1]) 35 'C51276336_DB-5MS', '', '', ''], lookup_dict['51276336'][1])
145 145
146 def test_match_library_get_lib_files(self): 146 def test_match_library_get_lib_files(self):
147 ''' 147 '''
148 Tests the match_library.py functionality 148 Tests the match_library.py functionality
149 ''' 149 '''
150 riqc_libs_dir = resource_filename(__name__, "../repositories") 150 riqc_libs_dir = resource_filename(__name__, "../repositories/PRIMS-metabolomics/RI_DB_libraries")
151 get_library_files_output = match_library.get_directory_files(riqc_libs_dir) 151 get_library_files_output = match_library.get_directory_files(riqc_libs_dir)
152 self.assertEqual(4, len(get_library_files_output)) 152 self.assertEqual(2, len(get_library_files_output))
153 self.assertEqual("Library_RI_DB_capillary_columns-noDuplicates", get_library_files_output[0][0]) 153 self.assertEqual("Library_RI_DB_capillary_columns-noDuplicates", get_library_files_output[0][0])
154 #TODO change assert below to assert that the result is a file, so the test can run on other dirs as well: 154 #TODO change assert below to assert that the result is a file, so the test can run on other dirs as well:
155 #self.assertEqual("E:\\workspace\\PRIMS-metabolomics\\python-tools\\tools\\GCMS\\test\\data\\riqc_libs\\RI DB library (capillary columns) Dec.2012.txt", get_library_files_output[0][1]) 155 #self.assertEqual("E:\\workspace\\PRIMS-metabolomics\\python-tools\\tools\\GCMS\\test\\data\\riqc_libs\\RI DB library (capillary columns) Dec.2012.txt", get_library_files_output[0][1])
156 #self.assertEqual("RI DB library (capillary columns) Jan.2013", get_library_files_output[1][0]) 156 #self.assertEqual("RI DB library (capillary columns) Jan.2013", get_library_files_output[1][0])
157 try: 157 try: