コード例 #1
0
ファイル: location_stats.py プロジェクト: unicefuganda/necoc
 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)
コード例 #2
0
ファイル: location_stats.py プロジェクト: unicefuganda/necoc
 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)
コード例 #3
0
 def test_percentize(self):
     self.assertEqual(50, percentize(1, 2))
     self.assertEqual(0, percentize(0, 2))
     self.assertEqual(0, percentize(0, 0))