-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathgenereate_ngff_version_tests.py
More file actions
50 lines (36 loc) · 1.28 KB
/
genereate_ngff_version_tests.py
File metadata and controls
50 lines (36 loc) · 1.28 KB
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
44
45
46
47
48
49
50
import os
import sys
def generate_ngff_version_tests(version):
folder = f"./src/test/java/projects/ngff/v0{version}"
os.makedirs(folder, exist_ok=True)
test_names = {
"CYX": "cyx",
"CZYX": "czyx",
"MultiImage": "multi-image",
"TCYX": "tcyx",
"TCZYX": "tczyx",
"TYX": "tyx",
"YX": "yx",
"ZYX": "zyx",
}
for name, url_name in test_names.items():
# multi-image is only there for v>=0.4
if name == "MultiImage" and version < 4:
continue
# czyx is only there for v>=0.3
if name == "CZYX" and version < 3:
continue
test = f"""package projects.ngff.v0{version};
import mpicbg.spim.data.SpimDataException;
import projects.ngff.base.{name}NgffBaseTest;
public class {name}NgffV0{version}Test extends {name}NgffBaseTest{{
private static final String URL = "https://s3.embl.de/i2k-2020/ngff-example-data/v0.{version}/{url_name}.ome.zarr";
public {name}NgffV0{version}Test() throws SpimDataException {{
super(URL);
}}
}}"""
test_file = os.path.join(folder, f"{name}NgffV0{version}Test.java")
with open(test_file, "w") as f:
f.write(test)
if __name__ == "__main__":
generate_ngff_version_tests(int(sys.argv[1]))