Пример #1
0
    def testAllPositionsMustBeAwarded(self):
        result = generate_objects.valid_result_with_debate()
        result.og = 3
        result.co = 3
        with self.assertRaises(ValidationError):
            result.full_clean()

        result = generate_objects.valid_result_with_debate()
        result.og = 2
        result.oo = 2
        with self.assertRaises(ValidationError):
            result.full_clean()
Пример #2
0
 def testRaiseExceptionIfRoundHasPassed(self):
     result = generate_objects.valid_result_with_debate()
     tournament = Tournament.instance()
     tournament.round = 2
     tournament.save()
     with self.assertRaises(TournamentStateException):
         result.full_clean()
Пример #3
0
    def testTotalSpeakerScore(self):
        result = generate_objects.valid_result_with_debate()
        total_speaks = result.total_speaks()

        self.assertEqual(total_speaks['og'], result.ogsp1 + result.ogsp2)
        self.assertEqual(total_speaks['oo'], result.oosp1 + result.oosp2)
        self.assertEqual(total_speaks['cg'], result.cgsp1 + result.cgsp2)
        self.assertEqual(total_speaks['co'], result.cosp1 + result.cosp2)
Пример #4
0
    def testCreateResultFromSpeaks(self):
        result = generate_objects.valid_result_with_debate()
        result.og,result.oo,result.cg,result.co = None,None,None,None
        result.add_positions_from_speaks()

        self.assertEqual(result.og, 0)
        self.assertEqual(result.oo, 1)
        self.assertEqual(result.cg, 2)
        self.assertEqual(result.co, 3)
Пример #5
0
    def testSpeakerScoreMustBeConsistentWithTeamScore(self):
        result = generate_objects.valid_result_with_debate()
        result.ogsp1=1
        result.ogsp2=1
        result.og = 3
        result.oo = 2
        result.cg = 1
        result.co = 0

        with self.assertRaises(ValidationError):
            result.full_clean()
Пример #6
0
 def test_gets_result_that_exists(self):
     result = generate_objects.valid_result_with_debate()
     debate = result.debate
     self.assertEqual(debate.result, result, "Didn't return the result for the debate")
Пример #7
0
 def testMinSpeakerScore(self):
     result = generate_objects.valid_result_with_debate()
     result.ogsp2 = -2
     with self.assertRaises(ValidationError):
         result.full_clean()
Пример #8
0
 def testMaxTeamScore(self):
     result = generate_objects.valid_result_with_debate()
     result.og = 4
     with self.assertRaises(ValidationError):
         result.full_clean()