Skip to content

Commit fbf045e

Browse files
committed
テストを修正
1 parent 1e56ccd commit fbf045e

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

tests/resources/test_setter/ans/main.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class Main {
55

6-
// Generated by x.x.x https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)
6+
// Generated by x.x.x
77
public static void main(String[] args) throws Exception {
88
final Scanner sc = new Scanner(System.in);
99
long T;
@@ -17,3 +17,4 @@ static void solve(long T, long X){
1717

1818
}
1919
}
20+

tests/test_setter.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ def get_all_rel_file_paths(dir_path: str):
2727
return sorted(res)
2828

2929

30+
def _strip_version_info_java(java_source: str) -> str:
31+
result = ""
32+
for line in java_source.split("\n"):
33+
if line.startswith(" // Generated by"):
34+
result += " // Generated by x.x.x"
35+
else:
36+
result += line
37+
result += "\n"
38+
return result
39+
40+
3041
class TestSetter(unittest.TestCase):
3142

3243
def setUp(self):
@@ -47,7 +58,7 @@ def test_setter_change_lang(self):
4758
"--dir", test_dir,
4859
"--without-login"]
4960
)
50-
self.assertEqual(open(os.path.join(test_dir, "main.java")).read(),
61+
self.assertEqual(_strip_version_info_java(open(os.path.join(test_dir, "main.java")).read()),
5162
open(os.path.join(RESOURCE_DIR, "ans", "main.java")).read())
5263

5364
metadata = Metadata.load_from(os.path.join(test_dir, "metadata.json"))

0 commit comments

Comments
 (0)