@@ -1214,6 +1214,11 @@ def setup(self):
12141214 )
12151215 self ._has_precompiled = False
12161216
1217+ def uses_default_validator (self ) -> bool :
1218+ if self .problem .format is FormatVersion .LEGACY :
1219+ return self .problem .metadata .legacy_validation == 'default'
1220+ return not self ._validators
1221+
12171222 def __str__ (self ) -> str :
12181223 return 'output validators'
12191224
@@ -1238,12 +1243,15 @@ def check(self, context: Context) -> bool:
12381243 f'Output validator in { v .language .name } . Only { safe_output_validator_languages } are standardized. Check carefully if your CCS supports more (Kattis does not).'
12391244 )
12401245
1241- if self .problem .metadata .legacy_validation == 'default' and self ._validators :
1246+ if len (self ._validators ) > 1 :
1247+ self .error_in_2023_07 ('Found more than one output validator. This was allowed in legacy (but not on Kattis)' )
1248+
1249+ if self .uses_default_validator () and self ._validators :
12421250 self .error ('There are validator programs but problem.yaml has validation = "default"' )
1243- elif self .problem . metadata . legacy_validation . startswith ( 'custom' ) and not self ._validators :
1251+ elif not self .uses_default_validator ( ) and not self ._validators :
12441252 self .fatal ('problem.yaml specifies custom validator but no validator programs found' )
12451253
1246- if self .problem . metadata . legacy_validation == 'default' and self ._default_validator is None :
1254+ if self .uses_default_validator () and self ._default_validator is None :
12471255 self .fatal ('Unable to locate default validator' )
12481256
12491257 for val in self ._validators [:]:
@@ -1336,10 +1344,9 @@ def _parse_validator_results(self, val, status: int, feedbackdir, testcase: Test
13361344 return SubmissionResult ('AC' , score = score )
13371345
13381346 def _actual_validators (self ) -> list :
1339- vals = self ._validators
1340- if self .problem .metadata .legacy_validation == 'default' or (self .problem .format is FormatVersion .V_2023_07 and not vals ):
1341- vals = [self ._default_validator ]
1342- return [val for val in vals if val is not None ]
1347+ if self .uses_default_validator ():
1348+ return [self ._default_validator ]
1349+ return self ._validators
13431350
13441351 def validate_interactive (self , testcase : TestCase , submission , timelim : int , errorhandler : Submissions ) -> SubmissionResult :
13451352 # This may be called off-main thread.
@@ -1405,7 +1412,6 @@ def validate_interactive(self, testcase: TestCase, submission, timelim: int, err
14051412 shutil .rmtree (feedbackdir )
14061413 if res .verdict != 'AC' :
14071414 return res
1408- # TODO: check that all output validators give same result
14091415 return res
14101416
14111417 def validate (self , testcase : TestCase , submission_output : str ) -> SubmissionResult :
0 commit comments