def test_BuildMS(self, skipTest=False): import csv survey = csv.reader(open(self.survey_file , 'r'), delimiter=',', quotechar='"') # skip header, there is probably a better way to do this survey.next() stats = Statistics(self.taxonomy) _count=0 for row in survey: tax_string = row[2] stats.add_case(tax_string, parse_order=self.ms_parse_order) stats.finalize() ms = MappingScheme(self.taxonomy) ms_zone = MappingSchemeZone('ALL') ms.assign(ms_zone, stats) #ms.save(self.ms_file) if skipTest: return ms ms2 = MappingScheme(self.taxonomy) ms2.read(self.ms_file) self.assertEqual( ms.get_assignment_by_name("ALL").to_xml().strip().__len__(), ms2.get_assignment_by_name("ALL").to_xml().strip().__len__() )
def test_BuildMS(self, skipTest=False): import csv survey = csv.reader(open(self.survey_file, 'r'), delimiter=',', quotechar='"') # skip header, there is probably a better way to do this survey.next() stats = Statistics(self.taxonomy) _count = 0 for row in survey: tax_string = row[2] stats.add_case(tax_string, parse_order=self.ms_parse_order) stats.finalize() ms = MappingScheme(self.taxonomy) ms_zone = MappingSchemeZone('ALL') ms.assign(ms_zone, stats) #ms.save(self.ms_file) if skipTest: return ms ms2 = MappingScheme(self.taxonomy) ms2.read(self.ms_file) self.assertEqual( ms.get_assignment_by_name("ALL").to_xml().strip().__len__(), ms2.get_assignment_by_name("ALL").to_xml().strip().__len__())
def test_LoadMS(self, skipTest=False, statsOnly=True): ms = MappingScheme(self.taxonomy) ms.read(self.ms_file) if skipTest: if statsOnly: return ms.get_assignment_by_name("ALL") else: return ms stats = ms.get_assignment_by_name("ALL") attributes = stats.get_attributes(stats.get_tree()) self.assertEqual(sorted(attributes), sorted(self.ms_parse_order))
def test_LoadMS(self, skipTest=False, statsOnly=True): ms = MappingScheme(self.taxonomy) ms.read(self.ms_file) if skipTest: if statsOnly: return ms.get_assignment_by_name("ALL") else: return ms stats = ms.get_assignment_by_name("ALL") attributes = stats.get_attributes(stats.get_tree()) self.assertEqual(sorted(attributes), sorted(self.ms_parse_order))