Mercurial > repos > pieterlukasse > prims_metabolomics
view test/test_match_library.py @ 20:24fb75fedee0
Made calibration file configurable at UI.
author | pieter.lukasse@wur.nl |
---|---|
date | Tue, 11 Feb 2014 12:29:50 +0100 |
parents | 9d5f4f5f764b |
children |
line wrap: on
line source
''' Created on Mar 6, 2012 @author: marcelk ''' from GCMS import match_library import unittest from pkg_resources import resource_filename # @UnresolvedImport # pylint: disable=E0611 class Test(unittest.TestCase): ''' Tests the 'match_library' Galaxy tool ''' nist_db = resource_filename(__name__, "data/RIDB_subset.txt") def test_get_column_type(self): ''' Tests the 'get_column_type' function that returns tuples of unique elements for column types in the RI database ''' galaxy_output = match_library.get_column_type(self.nist_db) self.assertEqual([('Capillary(9999)', 'Capillary', False)], galaxy_output) def test_filter_column(self): ''' Tests the 'filter_column' function showing the column phase for all 'Capillary' columns ''' galaxy_output = match_library.filter_column(self.nist_db, 'Capillary') self.assertEqual([('Semi-standard non-polar(9999)', 'Semi-standard non-polar', False)], galaxy_output) def test_filter_column2(self): ''' Tests the 'filter_column' function showing all possibilities for columns having both the 'Capillary' and 'Semi-standard non-polar' properties ''' galaxy_output = match_library.filter_column2(self.nist_db, 'Capillary', 'Semi-standard non-polar') self.failUnless(('Apiezon M(6)', 'Apiezon M', False) in galaxy_output) def test_count_occurrence(self): ''' Tests the 'count_occurrence' function ''' test_list = [2, 0, 0, 2, 1, 3, 4, 5, 3, 2, 3, 4, 5, 5, 4, 2, 5, 3, 4, 3, 5, 4, 2, 0, 4] counts = match_library.count_occurrence(test_list) self.assertEqual({0: 3, 1: 1, 2: 5, 3: 5, 4: 6, 5: 5}, counts) if __name__ == "__main__": #import sys;sys.argv = ['', 'Test.testName'] unittest.main()