def test_get_percent_population_of_cluster(self): clusters = (Cluster(16, [16]), Cluster(4, [4, 5, 6, 7, 8]), Cluster(0, [0, 1, 2, 3]), Cluster(9, [9, 10, 11, 12, 13, 14, 15])) clustering = Clustering(clusters) total = 0 for i in range(4): total = total + clustering.get_population_percent_of_cluster(i) self.assertAlmostEqual(total, 100., 2)
def test_get_percent_population_of_cluster(self): clusters =( Cluster(16,[16]), Cluster(4,[4,5,6,7,8]), Cluster(0,[0,1,2,3]), Cluster(9,[9,10,11,12,13,14,15]) ) clusterization = Clustering(clusters) total = 0 for i in range(4): total = total + clusterization.get_population_percent_of_cluster(i) self.assertAlmostEqual(total, 100., 2)