Пример #1
0
 def testFish(self):
     from game.ranker import FishPersonalRanker
     ranker = FishPersonalRanker(self.r)
     ranker.rank()
     # for r in PersonalRating.objects.all():
     #     print r
     self.assertEquals(12, PersonalRating.objects.count())
     self.assertEquals(4.0, ranker.rating(
         Entity.objects.get(name=u'老大')).rating_singles)
     self.assertEquals(3.0, ranker.rating(
         Entity.objects.get(name=u'fish')).rating_singles)
Пример #2
0
 def testElo(self):
     from game.ranker import EloPersonalRanker
     ranker = EloPersonalRanker(self.r)
     ranker.rank()
     #for r in PersonalRating.objects.all():
     #    print r
     self.assertEquals(12, PersonalRating.objects.count())
     rating_laoda = ranker.rating(
         Entity.objects.get(name=u'老大')).rating_singles
     rating_fish = ranker.rating(
         Entity.objects.get(name=u'fish')).rating_singles
     rating_doubles_laoda = ranker.rating(
         Entity.objects.get(name=u'老大')).rating_doubles
     rating_doubles_zhutou = ranker.rating(
         Entity.objects.get(name=u'猪头')).rating_doubles
     self.assertTrue(rating_fish > rating_laoda)
     self.assertTrue(rating_doubles_laoda > rating_doubles_zhutou)