-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun_fiji_scripts_test.py
51 lines (39 loc) · 1.66 KB
/
run_fiji_scripts_test.py
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
51
import datetime
from run_fiji_scripts import *
import communicate as comm
from models_test import pt_model_record, tf_model_record
from communicate_test import affable_sark_model, joyful_deer_model, creative_panda_model
model_paths = list(map(lambda x: comm.get_model_folder_str(x), [pt_model_record, tf_model_record, affable_sark_model,
joyful_deer_model, creative_panda_model]))
# not so many assertions, outputs depend on absolute path of computer where tests are running
print("Testing script_names")
print(script_names[0])
print(script_names[1])
print()
print("Testing gen_messages")
t = datetime.datetime.now()
print(gen_messages(model_paths, k="start"))
print(gen_messages(model_paths, k="end"))
print()
print("Testing quote_arg")
assert quote_arg("abcv") == "folder='abcv'"
print(quote_arg(model_paths[0]))
print()
print("Testing compose_command")
print(compose_command(model_paths[1], script_names[1]))
print(" ".join(compose_command(model_paths[2], script_names[0]))) # <- useful to copy_paste in a cmd and run
print()
sample_scripts = list(map(lambda x: str(Path(".", "fiji_scripts", x).absolute()),
["test_1_with_deepimagej_test.py", "create_output_metrics_test.py"]))
print("Testing gen_execution_dicts")
exec_vector = gen_execution_dicts(model_paths, sample_scripts)
assert len(exec_vector) == 5
assert exec_vector[3]["message"] == '- MODEL 4/ 5\n'
print(exec_vector[3]["cmd-vecs"][0])
print(exec_vector[3]["cmd-vecs"][1])
print()
print("Testing run_exec_step")
run_exec_step(exec_vector[0])
print()
print("Testing run_exec_step")
test_models_in_fiji(model_paths[0:2], sample_scripts)