Skip to content

Commit 9ecb800

Browse files
authored
Merge pull request #215 from ghamerly/do-not-grade-empty-groups
Do not grade empty groups
2 parents 2cbe919 + 1ac5fc8 commit 9ecb800

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

problemtools/verifyproblem.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,9 @@ def check(self, args):
497497
if not f[:-4] + '.in' in infiles:
498498
self.error("No matching input file for answer '%s'" % f)
499499

500+
if not self.get_subgroups() and not self.get_testcases():
501+
self.error('Test case group is empty')
502+
500503
# Check whether a <= b according to a natural sorting where numeric components
501504
# are compactified, so that e.g. "a" < "a1" < "a2" < "a10" = "a010" < "a10a".
502505
def natural_sort_le(a, b):
@@ -1320,6 +1323,10 @@ def grade(self, sub_results, testcasegroup, shadow_result=False):
13201323
verdict = 'AC'
13211324
score = 0
13221325

1326+
if not sub_results:
1327+
self.info('No results on %s, so no graders ran' % (testcasegroup,))
1328+
return (verdict, score)
1329+
13231330
grader_flags = testcasegroup.config['grader_flags'].split()
13241331
self.debug('Grading %d results:\n%s' % (len(sub_results), grader_input))
13251332
self.debug('Grader flags: %s' % grader_flags)

support/default_grader/default_grader

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ try:
6868
score = aggregate_scores(scores)
6969
print('%s %f' % (verdict, score))
7070
except:
71-
print('JE')
71+
print('JE 0')

0 commit comments

Comments
 (0)