Skip to content

Commit 4b1cb82

Browse files
authored
Merge pull request #162 from online-judge-tools/fix/compatibility
Fix the schema schema_compatibility
2 parents 7209c46 + 13e5cdb commit 4b1cb82

File tree

2 files changed

+62
-15
lines changed

2 files changed

+62
-15
lines changed

onlinejudge_api/get_problem.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -217,21 +217,19 @@
217217
},
218218
"tests": {
219219
"type": "array",
220-
"items": [
221-
{
222-
"type": "object",
223-
"properties": {
224-
"input": {
225-
"type": "string",
226-
},
227-
"output": {
228-
"type": "string",
229-
},
220+
"items": {
221+
"type": "object",
222+
"properties": {
223+
"input": {
224+
"type": "string",
225+
},
226+
"output": {
227+
"type": "string",
230228
},
231-
"required": ["input", "output"],
232-
"additionalProperties": False,
233229
},
234-
],
230+
"required": ["input", "output"],
231+
"additionalProperties": False,
232+
},
235233
},
236234
},
237235
"required": [

tests/get_problem_atcoder.py

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,55 @@ def test_icpc2013spring_a(self):
4848
actual = main(['get-problem', url], debug=True)
4949
self.assertEqual(expected, actual)
5050

51+
def test_icpc2013spring_a_compatibility(self):
52+
"""This test checks --compatbility option
53+
"""
54+
55+
url = 'http://jag2013spring.contest.atcoder.jp/tasks/icpc2013spring_a'
56+
expected = {
57+
"status": "ok",
58+
"messages": [],
59+
"result": {
60+
"name": "A. Everlasting Zero",
61+
"group": "Japan Alumni Group Spring Contest 2013",
62+
"url": "https://atcoder.jp/contests/jag2013spring/tasks/icpc2013spring_a",
63+
"interactive": False,
64+
"memoryLimit": 128,
65+
"timeLimit": 5000,
66+
"tests": [{
67+
"input": "2 2\n2 \n1 >= 3\n2 <= 5\n2\n1 >= 4\n2 >= 3\n",
68+
"output": "Yes\n"
69+
}, {
70+
"input": "2 2\n2 \n1 >= 5\n2 >= 5\n2\n1 <= 4\n2 <= 3\n",
71+
"output": "Yes\n"
72+
}, {
73+
"input": "2 2\n2 \n1 >= 3\n2 <= 3\n2\n1 <= 2\n2 >= 5\n",
74+
"output": "No\n"
75+
}, {
76+
"input": "1 2\n2\n1 <= 10\n1 >= 15\n",
77+
"output": "No\n"
78+
}, {
79+
"input": "5 5\n3\n2 <= 1\n3 <= 1\n4 <= 1\n4\n2 >= 2\n3 <= 1\n4 <= 1\n5 <= 1\n3\n3 >= 2\n4 <= 1\n5 <= 1\n2\n4 >= 2\n5 <= 1\n1\n5 >= 2 \n",
80+
"output": "Yes\n"
81+
}],
82+
"testType": "single",
83+
"input": {
84+
"type": "stdin",
85+
},
86+
"output": {
87+
"type": "stdout",
88+
},
89+
"languages": {
90+
"java": {
91+
"mainClass": "Main",
92+
"taskClass": "Task",
93+
},
94+
},
95+
},
96+
}
97+
actual = main(['get-problem', url, "--compatibility"], debug=True)
98+
self.assertEqual(expected, actual)
99+
51100
def test_arc035_a(self):
52101
"""This problem uses <code> tags in the descriptoin text in the sample section.
53102
"""
@@ -236,7 +285,7 @@ def test_tenka1_2014_quala_e(self):
236285
self.assertEqual(expected, actual)
237286

238287
def test_non_existing_problem(self):
239-
"""This tests an non-existing problem.
288+
"""This tests a non-existing problem.
240289
"""
241290

242291
url = 'http://abc001.contest.atcoder.jp/tasks/abc001_100'
@@ -249,7 +298,7 @@ def test_non_existing_problem(self):
249298
self.assertEqual(expected, actual)
250299

251300
def test_impossible_problem(self):
252-
"""This tests a problem impossible to parse sample cases.
301+
"""This tests a problem of which it is impossible to parse sample cases.
253302
"""
254303

255304
url = 'https://chokudai001.contest.atcoder.jp/tasks/chokudai_001_a'

0 commit comments

Comments
 (0)