def test_vote_annotate(self):
        comments = [
            self.model(user=self.user1, content="I'm a comment, sequence %s" % i) for i in range(10)
            ]
        self.model.objects.bulk_create(comments)
        comments = list(self.model.objects.all())
        
        comment1 = comments[0]
        self.call_api('up', comment1, self.user2)

        comment2 = comments[1]
        self.call_api('up', comment2, self.user2)
        self.call_api('up', comment2, self.user3)

        # queryset=None, user=None
        # comments = self.model.votes.annotate()
        comments = self.call_api('annotate')

        self.assertEqual(comments[0].pk, comment2.pk)
        self.assertEqual(comments[1].pk, comment1.pk)
        
        # comments = list(self.model.votes.annotate(reverse=False))
        comments = list(self.call_api('annotate', reverse=False))
        self.assertEqual(comments[-1].pk, comment2.pk)
        self.assertEqual(comments[-2].pk, comment1.pk)
        
        for comment in comments:
            self.assertTrue(hasattr(comment, 'num_votes'))

        # call annotate with queryset and user
        comments = self.model.objects.filter(user=self.user1)
        # comments = self.model.votes.annotate(comments, user=self.user2)
        comments = self.call_api('annotate', queryset=comments, user=self.user2)
        self.assertEqual(comments[0].pk, comment2.pk)
        self.assertEqual(comments[1].pk, comment1.pk)
        for comment in comments:
            self.assertTrue(hasattr(comment, 'num_votes'))
            self.assertTrue(hasattr(comment, 'is_voted'))
            if comment.pk in (comment1.pk, comment2.pk):
                self.assertTrue(comment.is_voted)
            else:
                self.assertFalse(comment.is_voted)
dataset/ETHPy150Open Beeblio/django-vote/tests/tests.py/VoteTest.test_vote_annotate/original