def testUpgmaFitch(self):
     fitchTree = hw.upgma(hw.fitchList, hw.fitchMatrix)
     testFitchTree = (17.6, ('moth', (), ()),
                      (14.5, ('tuna', (), ()),
                       (9.0, (0.5, ('man', (), ()), ('monkey', (), ())),
                        (4.0, ('turtle', (), ()), ('chicken', (), ())))))
     self.assertTrue(isomorphic(fitchTree, testFitchTree),
                     "Incorrect fitch tree")
 def testUpgmaCarnivores(self):
     carnivoresTree = hw.upgma(hw.carnivoresList, hw.carnivoresMatrix)
     testCarnivoresTree = (45.375, ('cat', (), ()),
                           (21.666666666666664, ('dog', (), ()),
                            (18.25, ('seal', (), ()),
                             (13.0, ('bear', (), ()), ('raccoon', (),
                                                       ())))))
     self.assertTrue(isomorphic(carnivoresTree, testCarnivoresTree),
                     "Incorrect carnivores tree")
 def testUpgmaHumans(self):
     humansTree = hw.upgma(hw.humansList, hw.humansMatrix)
     testHumansTree = (0.0026804, ('San', (), ()),
                       (0.0023785, ('Kikuyu', (), ()),
                        (0.0010831666666666665, ('Yoruba', (), ()),
                         (0.0009215, ('Han', (), ()),
                          (0.000656, ('Finnish', (), ()), ('Papuan', (),
                                                           ()))))))
     self.assertTrue(isomorphic(humansTree, testHumansTree),
                     "Incorrect humans tree")
 def testUpgmaNeand(self):
     neandTree = hw.upgma(hw.neandList, hw.neandMatrix)
     testNeandTree = (0.0447688, ('Chimpanzee', (), ()),
                      (0.00571225, ('Neanderthal', (), ()),
                       (0.0026615, ('San', (), ()),
                        (0.00110925, ('Yoruba', (), ()),
                         (0.000656, ('Finnish', (), ()), ('Kostenki', (),
                                                          ()))))))
     self.assertTrue(isomorphic(neandTree, testNeandTree),
                     "Incorrect neand tree")
 def testUpgmaGroodies(self):
     groodiesTree = hw.upgma(hw.groodiesList, hw.groodiesMatrix)
     testGroodiesTree = (6.0, ('Snoody', (), ()), (3.5, ('Groody', (), ()),
                                                   ('Froody', (), ())))
     self.assertTrue(isomorphic(groodiesTree, testGroodiesTree),
                     "Incorrect groodies tree")