def test_limited_wls(self): """testing (well, exercising at least), wls with constrained start""" init = LoadTree(treestring='((a,c),b,d)') reconstructed = wls(self.dists, start=init) self.assertEqual(len(reconstructed.getTipNames()), 5) init2 = LoadTree(treestring='((a,d),b,c)') reconstructed = wls(self.dists, start=[init, init2]) self.assertEqual(len(reconstructed.getTipNames()), 5) init3 = LoadTree(treestring='((a,d),b,e)') self.assertRaises(Exception, wls, self.dists, start=[init, init3]) # if start tree has all seq names, should raise an error self.assertRaises(Exception, wls, self.dists, start=[LoadTree(treestring='((a,c),b,(d,e))')])
def test_truncated_wls(self): """testing wls with order option""" order = ['e', 'b', 'c', 'd'] reconstructed = wls(self.dists, order=order) self.assertEqual(set(reconstructed.getTipNames()), set(order))
def test_wls(self): """testing wls""" reconstructed = wls(self.dists) self.assertTreeDistancesEqual(self.tree, reconstructed)