def plotDataMean (self): import matplotlib.pyplot as plt import average data_array=average.mean(self.data) tag_array=average.getTag(self.data) plt.xlabel(tag_array) plt.plot(range(len(data_array)),data_array) plt.grid(True) plt.title('Mean value for each sub-category') plt.show()
def test_mean_is_zero_for_empty_dataset(self): self.assertEqual(average.mean([]), 0)
def test_mean_is_correct_for_known_output(self): self.assertEqual(average.mean([1,2,3]), 2)
def test_mean_returns_real_number(self): self.assertEqual(average.mean([1,2]), 1.5)
def test_mean_is_correct_for_single_value(self): self.assertEqual(average.mean([1]), 1)