def test_percentage(self): self.assertEqual(percentage(1, 10), 10)
def sold_share_by_site(items): """Each site's share in the number of items sold.""" total = total_sold(items) return [(site, percentage(sold, total)) for site, sold in sold_per_site(items)]
def sold_share_per_category(items): """Each category's share in the number of items sold.""" total = total_sold(items) return [(site, percentage(sold, total)) for site, sold in sold_per_category(items)]
def sales_share_per_category(items): """Each category's share in the sales volume.""" total = total_sales(items) return [(cat, percentage(sold, total)) for cat, sold in sales_per_category(items)]
def offered_share_per_category(items): """Each category's share in the number of offered items.""" total = count(items) return [(site, percentage(sold, total)) for site, sold in offered_per_category(items)]
def sales_share_by_site(items): """Each site's share in the sales volume.""" total = total_sales(items) return [(site, percentage(sold, total)) for site, sold in sales_per_site(items)]