@@ -4210,29 +4210,29 @@ class TestScoreDiff(TestCase):
42104210 'test_submission' ,
42114211 ]
42124212
4213+ submission_cls = IntegerScore
4214+ diff_cls = IntegerScore
4215+
4216+ def _set_contest_controller (self , name ):
4217+ contest = Contest .objects .get ()
4218+ contest .controller_name = name
4219+ contest .save ()
4220+
42134221 def _test_diff (self , new_score , expected_diff ):
42144222 pi = ProblemInstance .objects .get ()
42154223 user = User .objects .get (username = 'test_user' )
42164224 new_submission = Submission .objects .create (
42174225 problem_instance = pi ,
42184226 user = user ,
4219- score = IntegerScore (new_score ),
4227+ score = self . submission_cls (new_score ),
42204228 status = 'OK' ,
42214229 )
42224230 pi .controller .update_user_results (user , pi , new_submission )
4223- assert new_submission .score_diff == IntegerScore (expected_diff )
4231+ assert new_submission .score_diff == self . diff_cls (expected_diff )
42244232
4233+ class TestScoreDiffProgrammingContest (TestScoreDiff ):
42254234 def test_simple_programming_contest (self ):
42264235 # Simple programming contest takes last score as the final one.
42274236 self ._test_diff (50 , 50 - 34 )
42284237 self ._test_diff (100 , 100 - 50 )
42294238 self ._test_diff (20 , 20 - 100 )
4230-
4231- def test_oi_finals_contest (self ):
4232- # OI finals contest takes the best score as the final one.
4233- contest = Contest .objects .get ()
4234- contest .controller_name = 'oioioi.oi.controllers.OIFinalOnsiteContestController'
4235- contest .save ()
4236- self ._test_diff (50 , 50 - 34 )
4237- self ._test_diff (100 , 100 - 50 )
4238- self ._test_diff (20 , 0 )
0 commit comments