async def METHOD_NAME(self):
    ret = (
        await Book.annotate(sum=Sum("rating"))
        .group_by("author_id")
        .values_list("author_id", "sum")
    )
    for item in ret:
        author_id = item[0]
        sum_ = item[1]
        if author_id == self.a1.pk:
            self.assertEqual(sum_, 45.0)
        elif author_id == self.a2.pk:
            self.assertEqual(sum_, 10.0)