7
7
dbfile = resource_filename ('orientpy' ,
8
8
'examples/data/LOBS3.pkl' )
9
9
10
+
10
11
def test_dl_calc_args ():
11
12
from orientpy .scripts import dl_calc as dl
12
13
# no stdb
13
- with pytest .raises (SystemExit ) as excinfo :
14
- dl .get_dl_calc_arguments ()
15
- assert excinfo .value .code == 1
16
-
14
+ with pytest .raises (SystemExit ):
15
+ dl .get_dl_calc_arguments ([])
17
16
# defaults
18
17
args0 = dl .get_dl_calc_arguments ([dbfile ])
19
18
# keys
@@ -22,24 +21,21 @@ def test_dl_calc_args():
22
21
# start time
23
22
args = dl .get_dl_calc_arguments (
24
23
[dbfile , '--start' , '2014-10-01' ])
25
- with pytest .raises (SystemExit ) as excinfo :
24
+ with pytest .raises (SystemExit ):
26
25
dl .get_dl_calc_arguments ([
27
26
dbfile , '--start' , 'abcd' ])
28
- assert excinfo .value .code == 1
29
27
# end time
30
28
args = dl .get_dl_calc_arguments ([
31
29
dbfile , '--end' , '2015-01-01' ])
32
- with pytest .raises (SystemExit ) as excinfo :
30
+ with pytest .raises (SystemExit ):
33
31
dl .get_dl_calc_arguments ([
34
32
dbfile , '--end' , 'abcd' ])
35
- assert excinfo .value .code == 1
36
33
# user auth.
37
34
args = dl .get_dl_calc_arguments ([
38
35
dbfile , '-U' , 'bla:bla' ])
39
- with pytest .raises (SystemExit ) as excinfo :
36
+ with pytest .raises (SystemExit ):
40
37
dl .get_dl_calc_arguments ([
41
38
dbfile , '-U' , 'abcd' ])
42
- assert excinfo .value .code == 1
43
39
# local data
44
40
args = dl .get_dl_calc_arguments ([
45
41
dbfile , '--local-data' , 'bla' ])
@@ -49,12 +45,12 @@ def test_dl_calc_args():
49
45
50
46
return args0
51
47
48
+
52
49
def test_dl_average_args ():
53
50
from orientpy .scripts import dl_average as dl
54
51
# no stdb
55
- with pytest .raises (SystemExit ) as excinfo :
56
- dl .get_dl_average_arguments ()
57
- assert excinfo .value .code == 1
52
+ with pytest .raises (SystemExit ):
53
+ dl .get_dl_average_arguments ([])
58
54
# defaults
59
55
args0 = dl .get_dl_average_arguments ([dbfile ])
60
56
# keys
@@ -66,9 +62,8 @@ def test_dl_average_args():
66
62
def test_bng_calc_args ():
67
63
from orientpy .scripts import bng_calc_auto as bng
68
64
# no stdb
69
- with pytest .raises (SystemExit ) as excinfo :
70
- bng .get_bng_calc_arguments ()
71
- assert excinfo .value .code == 1
65
+ with pytest .raises (SystemExit ):
66
+ bng .get_bng_calc_arguments ([])
72
67
# default
73
68
args0 = bng .get_bng_calc_arguments ([dbfile ])
74
69
# keys
@@ -77,24 +72,21 @@ def test_bng_calc_args():
77
72
# start time
78
73
args = bng .get_bng_calc_arguments (
79
74
[dbfile , '--start' , '2014-10-01' ])
80
- with pytest .raises (SystemExit ) as excinfo :
75
+ with pytest .raises (SystemExit ):
81
76
bng .get_bng_calc_arguments ([
82
77
dbfile , '--start' , 'abcd' ])
83
- assert excinfo .value .code == 1
84
78
# end time
85
79
args = bng .get_bng_calc_arguments ([
86
80
dbfile , '--end' , '2015-01-01' ])
87
- with pytest .raises (SystemExit ) as excinfo :
81
+ with pytest .raises (SystemExit ):
88
82
bng .get_bng_calc_arguments ([
89
83
dbfile , '--end' , 'abcd' ])
90
- assert excinfo .value .code == 1
91
84
# user auth.
92
85
args = bng .get_bng_calc_arguments ([
93
86
dbfile , '-U' , 'bla:bla' ])
94
- with pytest .raises (SystemExit ) as excinfo :
87
+ with pytest .raises (SystemExit ):
95
88
bng .get_bng_calc_arguments ([
96
89
dbfile , '-U' , 'abcd' ])
97
- assert excinfo .value .code == 1
98
90
# local data
99
91
args = bng .get_bng_calc_arguments ([
100
92
dbfile , '--local-data' , 'bla' ])
@@ -104,26 +96,24 @@ def test_bng_calc_args():
104
96
# bp
105
97
args = bng .get_bng_calc_arguments ([
106
98
dbfile , '--bp' , '1.,2.' ])
107
- with pytest .raises (SystemExit ) as excinfo :
99
+ with pytest .raises (SystemExit ):
108
100
bng .get_bng_calc_arguments ([
109
101
dbfile , '--bp' , '1.' ])
110
- assert excinfo .value .code == 1
111
102
# tt
112
103
args = bng .get_bng_calc_arguments ([
113
104
dbfile , '--times' , '1.,2.' ])
114
- with pytest .raises (SystemExit ) as excinfo :
105
+ with pytest .raises (SystemExit ):
115
106
bng .get_bng_calc_arguments ([
116
107
dbfile , '--times' , '1.' ])
117
- assert excinfo .value .code == 1
118
108
119
109
return args0
120
110
111
+
121
112
def test_bng_average_args ():
122
113
from orientpy .scripts import bng_average as bng
123
114
# no stdb
124
- with pytest .raises (SystemExit ) as excinfo :
125
- bng .get_bng_average_arguments ()
126
- assert excinfo .value .code == 1
115
+ with pytest .raises (SystemExit ):
116
+ bng .get_bng_average_arguments ([])
127
117
# defaults
128
118
args0 = bng .get_bng_average_arguments ([dbfile ])
129
119
# keys
0 commit comments