Example #1
0
 def stats(self):
     attribute_count = self.attribute_count()
     total_attribute_count = self.attribute_class.count_(**self.kwargs)
     percentage = percentize(attribute_count, total_attribute_count)
     reporter_ratio = make_ratio(attribute_count, self.reporters_count())
     return StatsDetails(attribute_count, percentage, reporter_ratio)
Example #2
0
 def stats(self):
     attribute_count = self.attribute_count()
     total_attribute_count = self.attribute_class.count_(**self.kwargs)
     percentage = percentize(attribute_count, total_attribute_count)
     reporter_ratio = make_ratio(attribute_count, self.reporters_count())
     return StatsDetails(attribute_count, percentage, reporter_ratio)
Example #3
0
 def test_percentize(self):
     self.assertEqual(50, percentize(1, 2))
     self.assertEqual(0, percentize(0, 2))
     self.assertEqual(0, percentize(0, 0))