async def METHOD_NAME(self):
    ret = (
        await Book.annotate(avg=Avg("rating"))
        .group_by("author__name")
        .values("author__name", "avg")
    )
    self.assertListSortEqual(
        ret,
        [{"author__name": "author1", "avg": 4.5}, {"author__name": "author2", "avg": 2}],
        sorted_key="author__name",
    )