def test_clasified_points(self):
        ranking_view = RankingMixin()
        ranking_view.candidate_queryset = Candidate.objects.all()


        clasified = ranking_view.get_clasified()

        success_index = ranking_view.success_index()

        possible_answers = clasified[0]["possible_answers"]
        actual_answers = clasified[0]["actual_answers"]
        expected_points1 = (success_index*actual_answers - (possible_answers-actual_answers))*possible_answers

        self.assertEquals(clasified[0]['points'], expected_points1)

        possible_answers = clasified[1]["possible_answers"]
        actual_answers = clasified[1]["actual_answers"]
        expected_points1 = (success_index*actual_answers - (possible_answers-actual_answers))*possible_answers

        self.assertEquals(clasified[1]['points'], expected_points1)
        
        possible_answers = clasified[2]["possible_answers"]
        actual_answers = clasified[2]["actual_answers"]
        expected_points1 = (success_index*actual_answers - (possible_answers-actual_answers))*possible_answers

        self.assertEquals(clasified[2]['points'], expected_points1)

        possible_answers = clasified[3]["possible_answers"]
        actual_answers = clasified[3]["actual_answers"]
        expected_points1 = (success_index*actual_answers - (possible_answers-actual_answers))*possible_answers

        self.assertEquals(clasified[3]['points'], expected_points1)
    def test_clasified_points(self):
        ranking_view = RankingMixin()
        ranking_view.candidate_queryset = Candidate.objects.all()

        clasified = ranking_view.get_clasified()

        success_index = ranking_view.success_index()

        possible_answers = clasified[0]["possible_answers"]
        actual_answers = clasified[0]["actual_answers"]
        expected_points1 = (
            success_index * actual_answers -
            (possible_answers - actual_answers)) * possible_answers

        self.assertEquals(clasified[0]['points'], expected_points1)

        possible_answers = clasified[1]["possible_answers"]
        actual_answers = clasified[1]["actual_answers"]
        expected_points1 = (
            success_index * actual_answers -
            (possible_answers - actual_answers)) * possible_answers

        self.assertEquals(clasified[1]['points'], expected_points1)

        possible_answers = clasified[2]["possible_answers"]
        actual_answers = clasified[2]["actual_answers"]
        expected_points1 = (
            success_index * actual_answers -
            (possible_answers - actual_answers)) * possible_answers

        self.assertEquals(clasified[2]['points'], expected_points1)

        possible_answers = clasified[3]["possible_answers"]
        actual_answers = clasified[3]["actual_answers"]
        expected_points1 = (
            success_index * actual_answers -
            (possible_answers - actual_answers)) * possible_answers

        self.assertEquals(clasified[3]['points'], expected_points1)
    def test_get_index(self):
        ranking_view = RankingMixin()
        ranking_view.candidate_queryset = Candidate.objects.all()

        expected_index = float(15) / float(6)
        self.assertEquals(ranking_view.success_index(), expected_index)
    def test_get_index(self):
        ranking_view = RankingMixin()
        ranking_view.candidate_queryset = Candidate.objects.all()

        expected_index = float(15)/float(6)
        self.assertEquals(ranking_view.success_index(), expected_index)