Skip to content

Commit

Permalink
Removed support for custom inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
cip999 committed Jan 13, 2023
1 parent 1869bc8 commit 35bba71
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions p2d/parse_polygon_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import pathlib
import re
import sys
from filecmp import cmp
import xml.etree.ElementTree

from p2d._version import __version__
Expand Down Expand Up @@ -153,14 +154,16 @@ def pol_path(*path):

input_format = testset.find('input-path-pattern').text
output_format = testset.find('answer-path-pattern').text
# Fetch samples from statements directory (for custum input/output)
# Fetch samples from statements directory (for custum output)
sample_input_format = input_format.replace('tests/', os.path.join('statements', 'english') + '/example.')
sample_output_format = output_format.replace('tests/', os.path.join('statements', 'english') + '/example.')

for test in testset.iter('test'):
if 'sample' in test.attrib and not cmp(pol_path(input_format % local_id), pol_path(sample_input_format % local_id)):
raise RuntimeError('Custom inputs are not supported.') # Becase DomJudge evaluates the same sample inputs that are provided to contestants.
t = {
'num': test_id,
'in': pol_path(sample_input_format % local_id) if 'sample' in test.attrib else pol_path(input_format % local_id),
'in': pol_path(input_format % local_id),
'out': pol_path(sample_output_format % local_id) if 'sample' in test.attrib else pol_path(output_format % local_id),
'is_sample': 'sample' in test.attrib
}
Expand Down

0 comments on commit 35bba71

Please sign in to comment.