@@ -145,131 +145,74 @@ def test_error_gs_dataset_mismatch(self):
145
145
with pytest .raises (ValueError ):
146
146
config .init_global (test_config )
147
147
148
- def test_eval_ml_coupling (self ):
148
+ @pytest .mark .parametrize ("ml_include, eval_include, expected_ml, expected_eval" , [
149
+ (True , True , True , True ),
150
+ (True , False , True , False ),
151
+ (False , True , False , False ),
152
+ (False , False , False , False )
153
+ ])
154
+ def test_eval_ml_coupling (self , ml_include , eval_include , expected_ml , expected_eval ):
149
155
test_config = get_test_config ()
150
- include_combos = [(True , True ), (True , False ), (False , True ), (False , False )]
151
-
152
- # ml: True evaluation: True
153
- test_config ["analysis" ]["ml" ]["include" ] = include_combos [0 ][0 ]
154
- test_config ["analysis" ]["evaluation" ]["include" ] = include_combos [0 ][1 ]
155
- config .init_global (test_config )
156
- assert config .config .analysis_include_ml == True and config .config .analysis_include_evaluation == True
157
-
158
- # ml: True evaluation: False
159
- test_config ["analysis" ]["ml" ]["include" ] = include_combos [1 ][0 ]
160
- test_config ["analysis" ]["evaluation" ]["include" ] = include_combos [1 ][1 ]
161
- config .init_global (test_config )
162
- assert config .config .analysis_include_ml == True and config .config .analysis_include_evaluation == False
163
-
164
- # ml: False evaluation: True
165
- test_config ["analysis" ]["ml" ]["include" ] = include_combos [2 ][0 ]
166
- test_config ["analysis" ]["evaluation" ]["include" ] = include_combos [2 ][1 ]
156
+ test_config ["analysis" ]["ml" ]["include" ] = ml_include
157
+ test_config ["analysis" ]["evaluation" ]["include" ] = eval_include
167
158
config .init_global (test_config )
168
- assert config .config .analysis_include_ml == False and config .config .analysis_include_evaluation == False
169
159
170
- # ml: False evaluation: False
171
- test_config ["analysis" ]["ml" ]["include" ] = include_combos [3 ][0 ]
172
- test_config ["analysis" ]["evaluation" ]["include" ] = include_combos [3 ][1 ]
173
- config .init_global (test_config )
174
- assert config .config .analysis_include_ml == False and config .config .analysis_include_evaluation == False
175
-
176
-
177
- def test_ml_agg_algo_coupling (self ):
160
+ assert config .config .analysis_include_ml == expected_ml
161
+ assert config .config .analysis_include_evaluation == expected_eval
178
162
163
+ @pytest .mark .parametrize ("ml_include, ml_agg_include, expected_ml, expected_ml_agg" , [
164
+ (True , True , True , True ),
165
+ (True , False , True , False ),
166
+ (False , True , False , False ),
167
+ (False , False , False , False )
168
+ ])
169
+ def test_ml_agg_algo_coupling (self , ml_include , ml_agg_include ,expected_ml , expected_ml_agg ):
179
170
test_config = get_test_config ()
180
- include_combos = [(True , True ), (True , False ), (False , True ), (False , False )]
181
-
182
- test_config ["analysis" ]["ml" ]["include" ] = include_combos [0 ][0 ]
183
- test_config ["analysis" ]["ml" ]["aggregate_per_algorithm" ] = include_combos [0 ][1 ]
184
- config .init_global (test_config )
185
- assert config .config .analysis_include_ml == True and config .config .analysis_include_ml_aggregate_algo == True
186
-
187
-
188
- test_config ["analysis" ]["ml" ]["include" ] = include_combos [1 ][0 ]
189
- test_config ["analysis" ]["ml" ]["aggregate_per_algorithm" ] = include_combos [1 ][1 ]
190
- config .init_global (test_config )
191
- assert config .config .analysis_include_ml == True and config .config .analysis_include_ml_aggregate_algo == False
192
-
193
-
194
- test_config ["analysis" ]["ml" ]["include" ] = include_combos [2 ][0 ]
195
- test_config ["analysis" ]["ml" ]["aggregate_per_algorithm" ] = include_combos [2 ][1 ]
171
+ test_config ["analysis" ]["ml" ]["include" ] = ml_include
172
+ test_config ["analysis" ]["ml" ]["aggregate_per_algorithm" ] = ml_agg_include
196
173
config .init_global (test_config )
197
- assert config .config .analysis_include_ml == False and config .config .analysis_include_ml_aggregate_algo == False
198
174
175
+ assert config .config .analysis_include_ml == expected_ml
176
+ assert config .config .analysis_include_ml_aggregate_algo == expected_ml_agg
199
177
200
- test_config [ "analysis" ][ "ml" ][ "include" ] = include_combos [ 3 ][ 0 ]
201
- test_config [ "analysis" ][ "ml" ][ "aggregate_per_algorithm" ] = include_combos [ 3 ][ 1 ]
202
- config . init_global ( test_config )
203
- assert config . config . analysis_include_ml == False and config . config . analysis_include_ml_aggregate_algo == False
204
-
205
- def test_eval_agg_algo_coupling ( self ):
206
-
178
+ @ pytest . mark . parametrize ( "eval_include, agg_algo, expected_eval, expected_agg_algo" , [
179
+ ( True , True , True , True ),
180
+ ( True , False , True , False ),
181
+ ( False , True , False , False ),
182
+ ( False , False , False , False ),
183
+ ])
184
+ def test_eval_agg_algo_coupling ( self , eval_include , agg_algo , expected_eval , expected_agg_algo ):
207
185
test_config = get_test_config ()
208
186
test_config ["analysis" ]["ml" ]["include" ] = True
209
187
test_config ["analysis" ]["ml" ]["aggregate_per_algorithm" ] = True
210
188
211
- include_combos = [(True , True ), (True , False ), (False , True ), (False , False )]
189
+ test_config ["analysis" ]["evaluation" ]["include" ] = eval_include
190
+ test_config ["analysis" ]["evaluation" ]["aggregate_per_algorithm" ] = agg_algo
212
191
213
- test_config ["analysis" ]["evaluation" ]["include" ] = include_combos [0 ][0 ]
214
- test_config ["analysis" ]["evaluation" ]["aggregate_per_algorithm" ] = include_combos [0 ][1 ]
215
192
config .init_global (test_config )
216
- assert config .config .analysis_include_evaluation == True and config .config .analysis_include_evaluation_aggregate_algo == True
217
193
194
+ assert config .config .analysis_include_evaluation == expected_eval
195
+ assert config .config .analysis_include_evaluation_aggregate_algo == expected_agg_algo
218
196
219
- test_config ["analysis" ]["evaluation" ]["include" ] = include_combos [1 ][0 ]
220
- test_config ["analysis" ]["evaluation" ]["aggregate_per_algorithm" ] = include_combos [1 ][1 ]
221
- config .init_global (test_config )
222
- assert config .config .analysis_include_evaluation == True and config .config .analysis_include_evaluation_aggregate_algo == False
223
-
224
-
225
- test_config ["analysis" ]["evaluation" ]["include" ] = include_combos [2 ][0 ]
226
- test_config ["analysis" ]["evaluation" ]["aggregate_per_algorithm" ] = include_combos [2 ][1 ]
227
- config .init_global (test_config )
228
- assert config .config .analysis_include_evaluation == False and config .config .analysis_include_evaluation_aggregate_algo == False
229
-
230
-
231
- test_config ["analysis" ]["evaluation" ]["include" ] = include_combos [3 ][0 ]
232
- test_config ["analysis" ]["evaluation" ]["aggregate_per_algorithm" ] = include_combos [3 ][1 ]
233
- config .init_global (test_config )
234
- assert config .config .analysis_include_evaluation == False and config .config .analysis_include_evaluation_aggregate_algo == False
235
-
236
- def test_eval_ml_agg_algo_coupling (self ):
237
-
197
+ @pytest .mark .parametrize ("ml_include, ml_agg, eval_include, eval_agg, expected_ml, expected_ml_agg, expected_eval, expected_eval_agg" , [
198
+ (False , True , True , True , False , False , False , False ),
199
+ (True , False , True , True , True , False , True , False ),
200
+ (False , False , True , True , False , False , False , False ),
201
+ (True , True , True , True , True , True , True , True ),
202
+ (True , False , False , False , True , False , False , False ),
203
+ ])
204
+ def test_eval_ml_agg_algo_coupling (self , ml_include , ml_agg , eval_include , eval_agg , expected_ml , expected_ml_agg , expected_eval , expected_eval_agg ):
238
205
# the value of ml include and ml aggregate_per_algorithm can affect the value of evaluation include and evaluation aggregate_per_algorithm
239
-
240
206
test_config = get_test_config ()
241
207
242
- test_config ["analysis" ]["ml" ]["include" ] = False
243
- test_config ["analysis" ]["ml" ]["aggregate_per_algorithm" ] = True
244
- test_config ["analysis" ]["evaluation" ]["include" ] = True
245
- test_config ["analysis" ]["evaluation" ]["aggregate_per_algorithm" ] = True
246
- config .init_global (test_config )
247
- assert config .config .analysis_include_evaluation == False and config .config .analysis_include_evaluation_aggregate_algo == False and config .config .analysis_include_ml == False and config .config .analysis_include_ml_aggregate_algo == False
208
+ test_config ["analysis" ]["ml" ]["include" ] = ml_include
209
+ test_config ["analysis" ]["ml" ]["aggregate_per_algorithm" ] = ml_agg
210
+ test_config ["analysis" ]["evaluation" ]["include" ] = eval_include
211
+ test_config ["analysis" ]["evaluation" ]["aggregate_per_algorithm" ] = eval_agg
248
212
249
- test_config ["analysis" ]["ml" ]["include" ] = True
250
- test_config ["analysis" ]["ml" ]["aggregate_per_algorithm" ] = False
251
- test_config ["analysis" ]["evaluation" ]["include" ] = True
252
- test_config ["analysis" ]["evaluation" ]["aggregate_per_algorithm" ] = True
253
- config .init_global (test_config )
254
- assert config .config .analysis_include_evaluation == True and config .config .analysis_include_evaluation_aggregate_algo == False and config .config .analysis_include_ml == True and config .config .analysis_include_ml_aggregate_algo == False
255
-
256
- test_config ["analysis" ]["ml" ]["include" ] = False
257
- test_config ["analysis" ]["ml" ]["aggregate_per_algorithm" ] = False
258
- test_config ["analysis" ]["evaluation" ]["include" ] = True
259
- test_config ["analysis" ]["evaluation" ]["aggregate_per_algorithm" ] = True
260
213
config .init_global (test_config )
261
- assert config .config .analysis_include_evaluation == False and config .config .analysis_include_evaluation_aggregate_algo == False and config .config .analysis_include_ml == False and config .config .analysis_include_ml_aggregate_algo == False
262
214
263
- test_config ["analysis" ]["ml" ]["include" ] = True
264
- test_config ["analysis" ]["ml" ]["aggregate_per_algorithm" ] = True
265
- test_config ["analysis" ]["evaluation" ]["include" ] = True
266
- test_config ["analysis" ]["evaluation" ]["aggregate_per_algorithm" ] = True
267
- config .init_global (test_config )
268
- assert config .config .analysis_include_evaluation == True and config .config .analysis_include_evaluation_aggregate_algo == True and config .config .analysis_include_ml == True and config .config .analysis_include_ml_aggregate_algo == True
269
-
270
- test_config ["analysis" ]["ml" ]["include" ] = True
271
- test_config ["analysis" ]["ml" ]["aggregate_per_algorithm" ] = False
272
- test_config ["analysis" ]["evaluation" ]["include" ] = False
273
- test_config ["analysis" ]["evaluation" ]["aggregate_per_algorithm" ] = False
274
- config .init_global (test_config )
275
- assert config .config .analysis_include_evaluation == False and config .config .analysis_include_evaluation_aggregate_algo == False and config .config .analysis_include_ml == True and config .config .analysis_include_ml_aggregate_algo == False
215
+ assert config .config .analysis_include_ml == expected_ml
216
+ assert config .config .analysis_include_ml_aggregate_algo == expected_ml_agg
217
+ assert config .config .analysis_include_evaluation == expected_eval
218
+ assert config .config .analysis_include_evaluation_aggregate_algo == expected_eval_agg
0 commit comments