-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathunittests.py
More file actions
92 lines (72 loc) · 2.17 KB
/
unittests.py
File metadata and controls
92 lines (72 loc) · 2.17 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import unittest
from train import main
import os
if "TRAINDATA_PATH" not in os.environ.keys():
raise ValueError("The unittests requires the environment variables 'TRAINDATA_PATH' and 'VALIDATA_PATH' to be set")
class TestTraining(unittest.TestCase):
def get_common_args(self):
return dict(
batch_size=1,
nworkers=0,
outdir="/tmp/",
num_epochs=1,
snapshot=None,
finetune=None,
lr=0.01,
lradapt=1,
labelimage="buildings10m.tif",
smoketest=True,
trainpath=os.environ["TRAINDATA_PATH"],
validpath=os.environ["VALIDATA_PATH"])
def test_experiment_s1(self):
args = self.get_common_args()
args["experiment"] = "s1"
try:
main(**args)
except Exception as err:
raise err
self.fail(err)
def test_experiment_s2(self):
args = self.get_common_args()
args["experiment"] = "s2"
try:
main(**args)
except Exception as err:
self.fail(err)
def test_experiment_vhr(self):
args = self.get_common_args()
args["experiment"] = "vhr"
try:
main(**args)
except Exception as err:
self.fail(err)
def test_experiment_vhrs1(self):
args = self.get_common_args()
args["experiment"] = "vhrs1"
try:
main(**args)
except Exception as err:
self.fail(err)
def test_experiment_vhrs2(self):
args = self.get_common_args()
args["experiment"] = "vhrs2"
try:
main(**args)
except Exception as err:
self.fail(err)
def test_experiment_s1s2(self):
args = self.get_common_args()
args["experiment"] = "s1s2"
try:
main(**args)
except Exception as err:
self.fail(err)
def test_experiment_vhrs1s2(self):
args = self.get_common_args()
args["experiment"] = "vhrs1s2"
try:
main(**args)
except Exception as err:
self.fail(err)
if __name__ == '__main__':
unittest.main()