def test_geometric_mean(self): """ Verify the correct value is produced and it allows processing of long lists of values where some algorithm fails. """ self.assertEqual(data_structures.geometric_mean(range(1, 180)), 67.1555819421869)
def test_geometric_mean(self): """ Verify the correct value is produced and it allows processing of long lists of values where some algorithm fails. """ self.assertEqual(data_structures.geometric_mean(xrange(1, 180)), 67.1555819421869)
def average_performance(results, size=None): """ Flattens a list containing performance results. :param results: List of n lists containing data from performance runs. :param size: Numerical value of a size (say, file_size) that was used to filter the original results list. :return: List with 1 list containing average data from the performance run. """ average_line = [] if size is not None: average_line.append(size) for i in range(2, 15): average = data_structures.geometric_mean( [line[i] for line in results]) / 1024.0 average = int(average) average_line.append(average) return average_line