Skip to content

Commit 343c6c7

Browse files
Toshihiro ShimizuToshihiro Shimizu
authored andcommitted
追加
1 parent 5c72556 commit 343c6c7

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

tests/test_fmtprediction.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,15 @@ def test_overall(self):
3838
response = runner.run(case)
3939

4040
if response.status == "OK":
41-
output_text += "{:40} {:20} {} {}\n".format(case, response.status, response.simple_format,
41+
# TODO: インデックス0しか見ていない。本当はansの方を配列に変える方が適切
42+
first_format = response.simple_format[0]
43+
output_text += "{:40} {:20} {} {}\n".format(case, response.status, first_format,
4244
response.types)
45+
print("{:40} {:20} {} {}\n".format(case, response.status, first_format,
46+
response.types))
4347
else:
4448
output_text += "{:40} {}\n".format(case, response.status)
49+
print(output_text)
4550
with open("answer_text.txt", "w") as f:
4651
f.write(output_text)
4752
f.close()
@@ -62,7 +67,8 @@ def test_overall(self):
6267
logger.debug(
6368
"Sample Input {num}:\n{inp}".format(inp=s.get_input(), num=idx + 1))
6469
self.assertEqual(ans, out)
65-
70+
with open("~/git/atcoder-tools/output_answer.txt", "w") as f:
71+
f.write(output_text)
6672
self.assertEqual(len(answer), len(output_text))
6773

6874

tests/utils/fmtprediction_test_runner.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ def __init__(self, result: Optional[FormatPredictionResult], status):
1414
self.status = status
1515
if result:
1616
self.original_result = result
17-
self.simple_format = result.format
18-
var_info = [(var.name, var.type)
19-
for var in result.format.all_vars()]
17+
self.simple_format = list(map(lambda x: x.format, result))
18+
var_info = []
19+
for r in result:
20+
var_info += [(var.name, var.type)
21+
for var in r.format.all_vars()]
2022
self.types = [(name, type.to_py_type()) for name, type in var_info]
2123

2224

0 commit comments

Comments
 (0)