#NEWLINE# def test_faith_pd_root_not_observed( self ) : #NEWLINE# #INDENT# tree = TreeNode . read ( StringIO ( '((OTU1:0.1, OTU2:0.2):0.3, (OTU3:0.5, OTU4:0.7):1.1)root;' ) ) #NEWLINE# otu_ids = [ ( 'OTU%d' % i ) for i in range ( 1 , 5 ) ] #NEWLINE# actual = faith_pd ( [ 1 , 1 , 0 , 0 ] , otu_ids , tree ) #NEWLINE# expected = 0.6 #NEWLINE# self . assertAlmostEqual ( actual , expected ) #NEWLINE# actual = faith_pd ( [ 0 , 0 , 1 , 1 ] , otu_ids , i ) #NEWLINE# expected = 2.3 #NEWLINE# self . assertAlmostEqual ( actual , expected )