Beispiel #1
0
 def test_init(self):
     """NcbiName should init OK with well-formed name line"""
     line_1 = """1\t|\tall\t|\t\t|\tsynonym\t|\n"""
     line_2 = """1\t|\troot\t|\t\t|\tscientific name\t|\n"""
     line_3 = """2\t|\tBacteria\t|\tBacteria <bacteria>\t|\tscientific name\t|\n"""
     line_4 = """7\t|\tAzorhizobium caulinodans\t|\t\t|\tscientific name\t|\n"""
     name_1 = NcbiName(line_1)  # make an NcbiName object
     name_2 = NcbiName(line_2)  # from the corresponding line
     name_3 = NcbiName(line_3)
     name_4 = NcbiName(line_4)
     self.assertEqual(name_1.TaxonId, 1)  # test that the data
     self.assertEqual(name_1.NameClass, "synonym")  # fields in the object
     self.assertEqual(name_2.TaxonId, 1)  # hold right data
     self.assertEqual(name_2.NameClass, "scientific name")
     self.assertEqual(name_3.TaxonId, 2)
     self.assertEqual(name_3.NameClass, "scientific name")
     self.assertEqual(name_4.TaxonId, 7)
     self.assertEqual(name_4.NameClass, "scientific name")
Beispiel #2
0
 def test_str(self):
     """NcbiName str should return line in original format"""
     line = """1\t|\troot\t|\t\t|\tscientific name|\n"""
     name = NcbiName(line)
     self.assertEqual(str(name), line)