-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlocal_test_script.py
More file actions
43 lines (29 loc) · 982 Bytes
/
local_test_script.py
File metadata and controls
43 lines (29 loc) · 982 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import os
import sys
import core
import core.utils
class LocalDisplay(core.submission.Display):
def show(self, test_case, test_case_result):
print 'Finish ' + test_case.__repr__()
sys.stdout.flush()
def display_compile(compile_result):
print 'Finish compile with exit code %d' % compile_result.get_exit_code()
class ProblemSubmission:
def __init__(self, problem, language, file):
print problem
self.problem = core.Problem(**problem)
result = core.make_submission(
self.problem, language, file,
display_compile, displayClass=LocalDisplay
)
print result.get_score()
for id, result in result.get_test_case_results().iteritems():
print id, result
def run():
PATH = os.path.dirname(__file__)
prob_sub = core.utils.from_string(
ProblemSubmission,
file_name=os.path.join(PATH, 'local_test.json')
)
if __name__ == '__main__':
run()